Skip to content

Instantly share code, notes, and snippets.

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