Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created June 28, 2021 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/233ef1a1bcd8b77ed20715be68381a07 to your computer and use it in GitHub Desktop.
Save amankharwal/233ef1a1bcd8b77ed20715be68381a07 to your computer and use it in GitHub Desktop.
from sklearn.datasets import make_classification
from sklearn.linear_model import SGDClassifier
from sklearn.model_selection import cross_val_score
samples = 500
x, y = make_classification(n_samples=samples, n_features=2,
n_informative=2, n_redundant=0,
n_clusters_per_class=1)
SGD_classifier = SGDClassifier(loss="perceptron", learning_rate="optimal",
n_iter_no_change=10)
print(cross_val_score(SGD_classifier, x, y, scoring="accuracy", cv=10).mean())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment