Skip to content

Instantly share code, notes, and snippets.

Embed
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,
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