Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2021 14:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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,
SGD_classifier = SGDClassifier(loss="perceptron", learning_rate="optimal",
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