Created
January 5, 2022 11:39
-
-
Save Arunprakash-A/009fbdf154c26286d388ed86a663770d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import required packages | |
import numpy as np | |
import seaborn as sns | |
from sklearn.datasets import make_classification | |
from sklearn.linear_model import Perceptron | |
from sklearn.metrics import hinge_loss | |
# create a linearly separable datapoints | |
x,y = make_classification(n_redundant=0,n_features=2,n_clusters_per_class=1) | |
# convert the labels to 1 and -1 as we use perceptron loss | |
y = np.where(y==0,1,-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment