Plotting FSVM Classifier#

An example plot of fsvm.FuzzySVC

Train our classifier on very simple dataset

from fsvm import FuzzySVC

X = [[0, 0], [1, 1]]
y = [0, 1]
clf = FuzzySVC().fit(X, y)

Create a test dataset

import numpy as np

rng = np.random.RandomState(13)
X_test = rng.rand(500, 2)

Use scikit-learn to display the decision boundary

from sklearn.inspection import DecisionBoundaryDisplay

disp = DecisionBoundaryDisplay.from_estimator(clf, X_test)
disp.ax_.scatter(
    X_test[:, 0],
    X_test[:, 1],
    c=clf.predict(X_test),
    s=20,
    edgecolors="k",
    linewidths=0.5,
)
disp.ax_.set(
    xlabel="Feature 1",
    ylabel="Feature 2",
    title="FSVM Classifier Decision Boundary",
)
FSVM Classifier Decision Boundary
[Text(0.5, 23.52222222222222, 'Feature 1'), Text(30.972222222222214, 0.5, 'Feature 2'), Text(0.5, 1.0, 'FSVM Classifier Decision Boundary')]

Total running time of the script: (0 minutes 0.181 seconds)

Gallery generated by Sphinx-Gallery