8000 DOC Perceptron examples in Perceptron.py (#11798) · amueller/scikit-learn@b878513 · GitHub
[go: up one dir, main page]

Skip to content

Commit b878513

Browse files
Anubhav2000qinhanmin2014
authored andcommitted
DOC Perceptron examples in Perceptron.py (scikit-learn#11798)
1 parent ab82f57 commit b878513

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sklearn/linear_model/perceptron.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,20 @@ class Perceptron(BaseSGDClassifier):
123123
``Perceptron()`` is equivalent to `SGDClassifier(loss="perceptron",
124124
eta0=1, learning_rate="constant", penalty=None)`.
125125
126+
Examples
127+
--------
128+
>>> from sklearn.datasets import load_digits
129+
>>> from sklearn.linear_model import Perceptron
130+
>>> X, y = load_digits(return_X_y=True)
131+
>>> clf = Perceptron(tol=1e-3, random_state=0)
132+
>>> clf.fit(X, y)
133+
Perceptron(alpha=0.0001, class_weight=None, early_stopping=False, eta0=1.0,
134+
fit_intercept=True, max_iter=None, n_iter=None, n_iter_no_change=5,
135+
n_jobs=None, penalty=None, random_state=0, shuffle=True, tol=0.001,
136+
validation_fraction=0.1, verbose=0, warm_start=False)
137+
>>> clf.score(X, y) # doctest: +ELLIPSIS
138+
0.946...
139+
126140
See also
127141
--------
128142

0 commit comments

Comments
 (0)
0