DOC Perceptron examples in Perceptron.py
@@ -123,6 +123,20 @@ class Perceptron(BaseSGDClassifier):
``Perceptron()`` is equivalent to `SGDClassifier(loss="perceptron",
eta0=1, learning_rate="constant", penalty=None)`.
+ Examples
+ --------
+ >>> from sklearn.datasets import load_digits
+ >>> from sklearn.linear_model import Perceptron
+ >>> X, y = load_digits(return_X_y=True)
+ >>> clf = Perceptron(tol=1e-3, random_state=0)
+ >>> clf.fit(X, y)
+ Perceptron(alpha=0.0001, class_weight=None, early_stopping=False, eta0=1.0,
+ fit_intercept=True, max_iter=None, n_iter=None, n_iter_no_change=5,
+ n_jobs=None, penalty=None, random_state=0, shuffle=True, tol=0.001,
+ validation_fraction=0.1, verbose=0, warm_start=False)
+ >>> clf.score(X, y) # doctest: +ELLIPSIS
+ 0.946...
+
See also
--------
