Skip to content

Commit b90265e

Browse files
committed
Pushing the docs to dev/ for branch: main, commit f2231993675134ca7d01b1b8ebfd6d082372272e
1 parent 9bfdcae commit b90265e

File tree

1,219 files changed

+4205
-4205
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,219 files changed

+4205
-4205
lines changed
Binary file not shown.
Binary file not shown.

dev/_downloads/e9bb83e05aee6636f37a28a7de0813f3/plot_logistic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import numpy as np
1717
import matplotlib.pyplot as plt
1818

19-
from sklearn import linear_model
19+
from sklearn.linear_model import LogisticRegression, LinearRegression
2020
from scipy.special import expit
2121

22-
# General a toy dataset:s it's just a straight line with some Gaussian noise:
22+
# Generate a toy dataset, it's just a straight line with some Gaussian noise:
2323
xmin, xmax = -5, 5
2424
n_samples = 100
2525
np.random.seed(0)
@@ -31,7 +31,7 @@
3131
X = X[:, np.newaxis]
3232

3333
# Fit the classifier
34-
clf = linear_model.LogisticRegression(C=1e5)
34+
clf = LogisticRegression(C=1e5)
3535
clf.fit(X, y)
3636

3737
# and plot the result
@@ -43,7 +43,7 @@
4343
loss = expit(X_test * clf.coef_ + clf.intercept_).ravel()
4444
plt.plot(X_test, loss, color="red", linewidth=3)
4545

46-
ols = linear_model.LinearRegression()
46+
ols = LinearRegression()
4747
ols.fit(X, y)
4848
plt.plot(X_test, ols.coef_ * X_test + ols.intercept_, linewidth=1)
4949
plt.axhline(0.5, color=".5")

dev/_downloads/eff5561dfcda3a1dd15da0cd7d817e0d/plot_logistic.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-
"# Code source: Gael Varoquaux\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn import linear_model\nfrom scipy.special import expit\n\n# General a toy dataset:s it's just a straight line with some Gaussian noise:\nxmin, xmax = -5, 5\nn_samples = 100\nnp.random.seed(0)\nX = np.random.normal(size=n_samples)\ny = (X > 0).astype(float)\nX[X > 0] *= 4\nX += 0.3 * np.random.normal(size=n_samples)\n\nX = X[:, np.newaxis]\n\n# Fit the classifier\nclf = linear_model.LogisticRegression(C=1e5)\nclf.fit(X, y)\n\n# and plot the result\nplt.figure(1, figsize=(4, 3))\nplt.clf()\nplt.scatter(X.ravel(), y, color=\"black\", zorder=20)\nX_test = np.linspace(-5, 10, 300)\n\nloss = expit(X_test * clf.coef_ + clf.intercept_).ravel()\nplt.plot(X_test, loss, color=\"red\", linewidth=3)\n\nols = linear_model.LinearRegression()\nols.fit(X, y)\nplt.plot(X_test, ols.coef_ * X_test + ols.intercept_, linewidth=1)\nplt.axhline(0.5, color=\".5\")\n\nplt.ylabel(\"y\")\nplt.xlabel(\"X\")\nplt.xticks(range(-5, 10))\nplt.yticks([0, 0.5, 1])\nplt.ylim(-0.25, 1.25)\nplt.xlim(-4, 10)\nplt.legend(\n (\"Logistic Regression Model\", \"Linear Regression Model\"),\n loc=\"lower right\",\n fontsize=\"small\",\n)\nplt.tight_layout()\nplt.show()"
29+
"# Code source: Gael Varoquaux\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.linear_model import LogisticRegression, LinearRegression\nfrom scipy.special import expit\n\n# Generate a toy dataset, it's just a straight line with some Gaussian noise:\nxmin, xmax = -5, 5\nn_samples = 100\nnp.random.seed(0)\nX = np.random.normal(size=n_samples)\ny = (X > 0).astype(float)\nX[X > 0] *= 4\nX += 0.3 * np.random.normal(size=n_samples)\n\nX = X[:, np.newaxis]\n\n# Fit the classifier\nclf = LogisticRegression(C=1e5)\nclf.fit(X, y)\n\n# and plot the result\nplt.figure(1, figsize=(4, 3))\nplt.clf()\nplt.scatter(X.ravel(), y, color=\"black\", zorder=20)\nX_test = np.linspace(-5, 10, 300)\n\nloss = expit(X_test * clf.coef_ + clf.intercept_).ravel()\nplt.plot(X_test, loss, color=\"red\", linewidth=3)\n\nols = LinearRegression()\nols.fit(X, y)\nplt.plot(X_test, ols.coef_ * X_test + ols.intercept_, linewidth=1)\nplt.axhline(0.5, color=\".5\")\n\nplt.ylabel(\"y\")\nplt.xlabel(\"X\")\nplt.xticks(range(-5, 10))\nplt.yticks([0, 0.5, 1])\nplt.ylim(-0.25, 1.25)\nplt.xlim(-4, 10)\nplt.legend(\n (\"Logistic Regression Model\", \"Linear Regression Model\"),\n loc=\"lower right\",\n fontsize=\"small\",\n)\nplt.tight_layout()\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/scikit-learn-docs.zip

2.07 KB
Binary file not shown.
-124 Bytes
-341 Bytes
-483 Bytes
-48 Bytes
-20 Bytes

0 commit comments

Comments
 (0)