Skip to content

Commit 7df1be4

Browse files
committed
Pushing the docs to dev/ for branch: main, commit a6e1d2fdf7d1f3e6901819c91456bb67c405c646
1 parent b81ddf8 commit 7df1be4

File tree

1,266 files changed

+6052
-6073
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,266 files changed

+6052
-6073
lines changed
Binary file not shown.

dev/_downloads/4c1663175b07cf9608b07331aa180eb7/plot_logistic_multinomial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"# Authors: Tom Dupre la Tour <[email protected]>\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.datasets import make_blobs\nfrom sklearn.inspection import DecisionBoundaryDisplay\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.multiclass import OneVsRestClassifier\n\n# make 3-class dataset for classification\ncenters = [[-5, 0], [0, 1.5], [5, -1]]\nX, y = make_blobs(n_samples=1000, centers=centers, random_state=40)\ntransformation = [[0.4, 0.2], [-0.4, 1.2]]\nX = np.dot(X, transformation)\n\nfor multi_class in (\"multinomial\", \"ovr\"):\n clf = LogisticRegression(solver=\"sag\", max_iter=100, random_state=42)\n if multi_class == \"ovr\":\n clf = OneVsRestClassifier(clf)\n clf.fit(X, y)\n\n # print the training scores\n print(\"training score : %.3f (%s)\" % (clf.score(X, y), multi_class))\n\n _, ax = plt.subplots()\n DecisionBoundaryDisplay.from_estimator(\n clf, X, response_method=\"predict\", cmap=plt.cm.Paired, ax=ax\n )\n plt.title(\"Decision surface of LogisticRegression (%s)\" % multi_class)\n plt.axis(\"tight\")\n\n # Plot also the training points\n colors = \"bry\"\n for i, color in zip(clf.classes_, colors):\n idx = np.where(y == i)\n plt.scatter(\n X[idx, 0], X[idx, 1], c=color, cmap=plt.cm.Paired, edgecolor=\"black\", s=20\n )\n\n # Plot the three one-against-all classifiers\n xmin, xmax = plt.xlim()\n ymin, ymax = plt.ylim()\n if multi_class == \"ovr\":\n coef = np.concatenate([est.coef_ for est in clf.estimators_])\n intercept = np.concatenate([est.intercept_ for est in clf.estimators_])\n else:\n coef = clf.coef_\n intercept = clf.intercept_\n\n def plot_hyperplane(c, color):\n def line(x0):\n return (-(x0 * coef[c, 0]) - intercept[c]) / coef[c, 1]\n\n plt.plot([xmin, xmax], [line(xmin), line(xmax)], ls=\"--\", color=color)\n\n for i, color in zip(clf.classes_, colors):\n plot_hyperplane(i, color)\n\nplt.show()"
18+
"# Authors: Tom Dupre la Tour <[email protected]>\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.datasets import make_blobs\nfrom sklearn.inspection import DecisionBoundaryDisplay\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.multiclass import OneVsRestClassifier\n\n# make 3-class dataset for classification\ncenters = [[-5, 0], [0, 1.5], [5, -1]]\nX, y = make_blobs(n_samples=1000, centers=centers, random_state=40)\ntransformation = [[0.4, 0.2], [-0.4, 1.2]]\nX = np.dot(X, transformation)\n\nfor multi_class in (\"multinomial\", \"ovr\"):\n clf = LogisticRegression(solver=\"sag\", max_iter=100, random_state=42)\n if multi_class == \"ovr\":\n clf = OneVsRestClassifier(clf)\n clf.fit(X, y)\n\n # print the training scores\n print(\"training score : %.3f (%s)\" % (clf.score(X, y), multi_class))\n\n _, ax = plt.subplots()\n DecisionBoundaryDisplay.from_estimator(\n clf, X, response_method=\"predict\", cmap=plt.cm.Paired, ax=ax\n )\n plt.title(\"Decision surface of LogisticRegression (%s)\" % multi_class)\n plt.axis(\"tight\")\n\n # Plot also the training points\n colors = \"bry\"\n for i, color in zip(clf.classes_, colors):\n idx = np.where(y == i)\n plt.scatter(X[idx, 0], X[idx, 1], c=color, edgecolor=\"black\", s=20)\n\n # Plot the three one-against-all classifiers\n xmin, xmax = plt.xlim()\n ymin, ymax = plt.ylim()\n if multi_class == \"ovr\":\n coef = np.concatenate([est.coef_ for est in clf.estimators_])\n intercept = np.concatenate([est.intercept_ for est in clf.estimators_])\n else:\n coef = clf.coef_\n intercept = clf.intercept_\n\n def plot_hyperplane(c, color):\n def line(x0):\n return (-(x0 * coef[c, 0]) - intercept[c]) / coef[c, 1]\n\n plt.plot([xmin, xmax], [line(xmin), line(xmax)], ls=\"--\", color=color)\n\n for i, color in zip(clf.classes_, colors):\n plot_hyperplane(i, color)\n\nplt.show()"
1919
]
2020
}
2121
],
Binary file not shown.

dev/_downloads/85c522d0f7149f3e8274112a6d62256f/plot_logistic_multinomial.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
colors = "bry"
4747
for i, color in zip(clf.classes_, colors):
4848
idx = np.where(y == i)
49-
plt.scatter(
50-
X[idx, 0], X[idx, 1], c=color, cmap=plt.cm.Paired, edgecolor="black", s=20
51-
)
49+
plt.scatter(X[idx, 0], X[idx, 1], c=color, edgecolor="black", s=20)
5250

5351
# Plot the three one-against-all classifiers
5452
xmin, xmax = plt.xlim()

dev/_downloads/scikit-learn-docs.zip

-2.75 KB
Binary file not shown.
-187 Bytes
86 Bytes
0 Bytes
656 Bytes
264 Bytes
-1 Bytes
-64 Bytes
180 Bytes
-22 Bytes
1.07 KB
75 Bytes
88 Bytes
35 Bytes
-53 Bytes
-208 Bytes
-116 Bytes
-31 Bytes
170 Bytes
-33 Bytes
77 Bytes
260 Bytes
145 Bytes
982 Bytes
-13 Bytes
-938 Bytes
-498 Bytes
-38 Bytes
-6 Bytes
-36 Bytes
62 Bytes
-9 Bytes

dev/_sources/auto_examples/applications/plot_cyclical_feature_engineering.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_digits_denoising.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_face_recognition.rst.txt

Lines changed: 4 additions & 4 deletions

dev/_sources/auto_examples/applications/plot_model_complexity_influence.rst.txt

Lines changed: 15 additions & 15 deletions

dev/_sources/auto_examples/applications/plot_out_of_core_classification.rst.txt

Lines changed: 29 additions & 29 deletions

dev/_sources/auto_examples/applications/plot_outlier_detection_wine.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_prediction_latency.rst.txt

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)