Skip to content

Commit 8258e8a

Browse files
committed
Pushing the docs to dev/ for branch: master, commit e3fe559a870cbe52bbdd23fd1c74f07ec83052f5
1 parent c9d2d2a commit 8258e8a

File tree

1,177 files changed

+3648
-3648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,177 files changed

+3648
-3648
lines changed

dev/_downloads/18771ded92de7c896426232db4ecc24e/plot_sgd_weighted_samples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
cmap=plt.cm.bone, edgecolor='black')
2828

2929
# fit the unweighted model
30-
clf = linear_model.SGDClassifier(alpha=0.01, max_iter=100, tol=1e-3)
30+
clf = linear_model.SGDClassifier(alpha=0.01, max_iter=100)
3131
clf.fit(X, y)
3232
Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
3333
Z = Z.reshape(xx.shape)
3434
no_weights = plt.contour(xx, yy, Z, levels=[0], linestyles=['solid'])
3535

3636
# fit the weighted model
37-
clf = linear_model.SGDClassifier(alpha=0.01, max_iter=100, tol=1e-3)
37+
clf = linear_model.SGDClassifier(alpha=0.01, max_iter=100)
3838
clf.fit(X, y, sample_weight=sample_weight)
3939
Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
4040
Z = Z.reshape(xx.shape)

dev/_downloads/1abc4484d4183963e2039c8c679497eb/plot_sgd_comparison.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"# Author: Rob Zinkov <rob at zinkov dot com>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import datasets\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import SGDClassifier, Perceptron\nfrom sklearn.linear_model import PassiveAggressiveClassifier\nfrom sklearn.linear_model import LogisticRegression\n\nheldout = [0.95, 0.90, 0.75, 0.50, 0.01]\nrounds = 20\nX, y = datasets.load_digits(return_X_y=True)\n\nclassifiers = [\n (\"SGD\", SGDClassifier(max_iter=100, tol=1e-3)),\n (\"ASGD\", SGDClassifier(average=True, max_iter=1000, tol=1e-3)),\n (\"Perceptron\", Perceptron(tol=1e-3)),\n (\"Passive-Aggressive I\", PassiveAggressiveClassifier(loss='hinge',\n C=1.0, tol=1e-4)),\n (\"Passive-Aggressive II\", PassiveAggressiveClassifier(loss='squared_hinge',\n C=1.0, tol=1e-4)),\n (\"SAG\", LogisticRegression(solver='sag', tol=1e-1, C=1.e4 / X.shape[0]))\n]\n\nxx = 1. - np.array(heldout)\n\nfor name, clf in classifiers:\n print(\"training %s\" % name)\n rng = np.random.RandomState(42)\n yy = []\n for i in heldout:\n yy_ = []\n for r in range(rounds):\n X_train, X_test, y_train, y_test = \\\n train_test_split(X, y, test_size=i, random_state=rng)\n clf.fit(X_train, y_train)\n y_pred = clf.predict(X_test)\n yy_.append(1 - np.mean(y_pred == y_test))\n yy.append(np.mean(yy_))\n plt.plot(xx, yy, label=name)\n\nplt.legend(loc=\"upper right\")\nplt.xlabel(\"Proportion train\")\nplt.ylabel(\"Test Error Rate\")\nplt.show()"
29+
"# Author: Rob Zinkov <rob at zinkov dot com>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import datasets\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import SGDClassifier, Perceptron\nfrom sklearn.linear_model import PassiveAggressiveClassifier\nfrom sklearn.linear_model import LogisticRegression\n\nheldout = [0.95, 0.90, 0.75, 0.50, 0.01]\nrounds = 20\nX, y = datasets.load_digits(return_X_y=True)\n\nclassifiers = [\n (\"SGD\", SGDClassifier(max_iter=100)),\n (\"ASGD\", SGDClassifier(average=True, max_iter=1000)),\n (\"Perceptron\", Perceptron(tol=1e-3)),\n (\"Passive-Aggressive I\", PassiveAggressiveClassifier(loss='hinge',\n C=1.0, tol=1e-4)),\n (\"Passive-Aggressive II\", PassiveAggressiveClassifier(loss='squared_hinge',\n C=1.0, tol=1e-4)),\n (\"SAG\", LogisticRegression(solver='sag', tol=1e-1, C=1.e4 / X.shape[0]))\n]\n\nxx = 1. - np.array(heldout)\n\nfor name, clf in classifiers:\n print(\"training %s\" % name)\n rng = np.random.RandomState(42)\n yy = []\n for i in heldout:\n yy_ = []\n for r in range(rounds):\n X_train, X_test, y_train, y_test = \\\n train_test_split(X, y, test_size=i, random_state=rng)\n clf.fit(X_train, y_train)\n y_pred = clf.predict(X_test)\n yy_.append(1 - np.mean(y_pred == y_test))\n yy.append(np.mean(yy_))\n plt.plot(xx, yy, label=name)\n\nplt.legend(loc=\"upper right\")\nplt.xlabel(\"Proportion train\")\nplt.ylabel(\"Test Error Rate\")\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/275c1a8902428a3a52b079bb6f13591a/plot_sgd_separating_hyperplane.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# fit the model
2121
clf = SGDClassifier(loss="hinge", alpha=0.01, max_iter=200,
22-
fit_intercept=True, tol=1e-3)
22+
fit_intercept=True)
2323
clf.fit(X, Y)
2424

2525
# plot the line, the points, and the nearest vectors to the plane
Binary file not shown.

dev/_downloads/3650884f0a646ba96d2e47df0a6fb935/plot_sgd_comparison.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
X, y = datasets.load_digits(return_X_y=True)
2525

2626
classifiers = [
27-
("SGD", SGDClassifier(max_iter=100, tol=1e-3)),
28-
("ASGD", SGDClassifier(average=True, max_iter=1000, tol=1e-3)),
27+
("SGD", SGDClassifier(max_iter=100)),
28+
("ASGD", SGDClassifier(average=True, max_iter=1000)),
2929
("Perceptron", Perceptron(tol=1e-3)),
3030
("Passive-Aggressive I", PassiveAggressiveClassifier(loss='hinge',
3131
C=1.0, tol=1e-4)),

dev/_downloads/4339c826f9873f4c9ebbcaf331f57b9d/grid_search_text_feature_extraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
pipeline = Pipeline([
8888
('vect', CountVectorizer()),
8989
('tfidf', TfidfTransformer()),
90-
('clf', SGDClassifier(tol=1e-3)),
90+
('clf', SGDClassifier()),
9191
])
9292

9393
# uncommenting more parameters will give better exploring power but will

dev/_downloads/4452f13fc6e1f6bc2280af49e5c4afde/plot_sgd_iris.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
h = .02 # step size in the mesh
4040

41-
clf = SGDClassifier(alpha=0.001, max_iter=100, tol=1e-3).fit(X, y)
41+
clf = SGDClassifier(alpha=0.001, max_iter=100).fit(X, y)
4242

4343
# create a mesh to plot in
4444
x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1

dev/_downloads/4aaaf51a640f112464b83039979cb0fe/plot_sgd_weighted_samples.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import linear_model\n\n# we create 20 points\nnp.random.seed(0)\nX = np.r_[np.random.randn(10, 2) + [1, 1], np.random.randn(10, 2)]\ny = [1] * 10 + [-1] * 10\nsample_weight = 100 * np.abs(np.random.randn(20))\n# and assign a bigger weight to the last 10 samples\nsample_weight[:10] *= 10\n\n# plot the weighted data points\nxx, yy = np.meshgrid(np.linspace(-4, 5, 500), np.linspace(-4, 5, 500))\nplt.figure()\nplt.scatter(X[:, 0], X[:, 1], c=y, s=sample_weight, alpha=0.9,\n cmap=plt.cm.bone, edgecolor='black')\n\n# fit the unweighted model\nclf = linear_model.SGDClassifier(alpha=0.01, max_iter=100, tol=1e-3)\nclf.fit(X, y)\nZ = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])\nZ = Z.reshape(xx.shape)\nno_weights = plt.contour(xx, yy, Z, levels=[0], linestyles=['solid'])\n\n# fit the weighted model\nclf = linear_model.SGDClassifier(alpha=0.01, max_iter=100, tol=1e-3)\nclf.fit(X, y, sample_weight=sample_weight)\nZ = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])\nZ = Z.reshape(xx.shape)\nsamples_weights = plt.contour(xx, yy, Z, levels=[0], linestyles=['dashed'])\n\nplt.legend([no_weights.collections[0], samples_weights.collections[0]],\n [\"no weights\", \"with weights\"], loc=\"lower left\")\n\nplt.xticks(())\nplt.yticks(())\nplt.show()"
29+
"print(__doc__)\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import linear_model\n\n# we create 20 points\nnp.random.seed(0)\nX = np.r_[np.random.randn(10, 2) + [1, 1], np.random.randn(10, 2)]\ny = [1] * 10 + [-1] * 10\nsample_weight = 100 * np.abs(np.random.randn(20))\n# and assign a bigger weight to the last 10 samples\nsample_weight[:10] *= 10\n\n# plot the weighted data points\nxx, yy = np.meshgrid(np.linspace(-4, 5, 500), np.linspace(-4, 5, 500))\nplt.figure()\nplt.scatter(X[:, 0], X[:, 1], c=y, s=sample_weight, alpha=0.9,\n cmap=plt.cm.bone, edgecolor='black')\n\n# fit the unweighted model\nclf = linear_model.SGDClassifier(alpha=0.01, max_iter=100)\nclf.fit(X, y)\nZ = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])\nZ = Z.reshape(xx.shape)\nno_weights = plt.contour(xx, yy, Z, levels=[0], linestyles=['solid'])\n\n# fit the weighted model\nclf = linear_model.SGDClassifier(alpha=0.01, max_iter=100)\nclf.fit(X, y, sample_weight=sample_weight)\nZ = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])\nZ = Z.reshape(xx.shape)\nsamples_weights = plt.contour(xx, yy, Z, levels=[0], linestyles=['dashed'])\n\nplt.legend([no_weights.collections[0], samples_weights.collections[0]],\n [\"no weights\", \"with weights\"], loc=\"lower left\")\n\nplt.xticks(())\nplt.yticks(())\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/637afdd681404c733540858401aadf5c/wikipedia_principal_eigenvector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ def centrality_scores(X, alpha=0.85, max_iter=100, tol=1e-10):
224224

225225
print("Computing principal eigenvector score using a power iteration method")
226226
t0 = time()
227-
scores = centrality_scores(X, max_iter=100, tol=1e-10)
227+
scores = centrality_scores(X, max_iter=100)
228228
print("done in %0.3fs" % (time() - t0))
229229
pprint([names[i] for i in np.abs(scores).argsort()[-10:]])

dev/_downloads/80692cf167e9ea27b27e5bd144159c82/plot_out_of_core_classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def progress(blocknum, bs, size):
207207

208208
# Here are some classifiers that support the `partial_fit` method
209209
partial_fit_classifiers = {
210-
'SGD': SGDClassifier(max_iter=5, tol=1e-3),
210+
'SGD': SGDClassifier(max_iter=5),
211211
'Perceptron': Perceptron(tol=1e-3),
212212
'NB Multinomial': MultinomialNB(alpha=0.01),
213213
'Passive-Aggressive': PassiveAggressiveClassifier(tol=1e-3),

0 commit comments

Comments
 (0)