Skip to content

Commit f274c2e

Browse files
committed
Pushing the docs to dev/ for branch: master, commit cb16003751e23bf0b1d158a26343f99ebc785571
1 parent 6e0d18d commit f274c2e

File tree

971 files changed

+2905
-2908
lines changed

Some content is hidden

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

971 files changed

+2905
-2908
lines changed
94 Bytes
Binary file not shown.
97 Bytes
Binary file not shown.

dev/_downloads/plot_iris1.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\n\nfrom sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\n\n# Parameters\nn_classes = 3\nplot_colors = \"bry\"\nplot_step = 0.02\n\n# Load data\niris = load_iris()\n\nfor pairidx, pair in enumerate([[0, 1], [0, 2], [0, 3],\n [1, 2], [1, 3], [2, 3]]):\n # We only take the two corresponding features\n X = iris.data[:, pair]\n y = iris.target\n\n # Train\n clf = DecisionTreeClassifier().fit(X, y)\n\n # Plot the decision boundary\n plt.subplot(2, 3, pairidx + 1)\n\n x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n xx, yy = np.meshgrid(np.arange(x_min, x_max, plot_step),\n np.arange(y_min, y_max, plot_step))\n\n Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])\n Z = Z.reshape(xx.shape)\n cs = plt.contourf(xx, yy, Z, cmap=plt.cm.Paired)\n\n plt.xlabel(iris.feature_names[pair[0]])\n plt.ylabel(iris.feature_names[pair[1]])\n plt.axis(\"tight\")\n\n # Plot the training points\n for i, color in zip(range(n_classes), plot_colors):\n idx = np.where(y == i)\n plt.scatter(X[idx, 0], X[idx, 1], c=color, label=iris.target_names[i],\n cmap=plt.cm.Paired)\n\n plt.axis(\"tight\")\n\nplt.suptitle(\"Decision surface of a decision tree using paired features\")\nplt.legend()\nplt.show()"
29+
"print(__doc__)\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\n\n# Parameters\nn_classes = 3\nplot_colors = \"ryb\"\nplot_step = 0.02\n\n# Load data\niris = load_iris()\n\nfor pairidx, pair in enumerate([[0, 1], [0, 2], [0, 3],\n [1, 2], [1, 3], [2, 3]]):\n # We only take the two corresponding features\n X = iris.data[:, pair]\n y = iris.target\n\n # Train\n clf = DecisionTreeClassifier().fit(X, y)\n\n # Plot the decision boundary\n plt.subplot(2, 3, pairidx + 1)\n\n x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n xx, yy = np.meshgrid(np.arange(x_min, x_max, plot_step),\n np.arange(y_min, y_max, plot_step))\n plt.tight_layout(h_pad=0.5, w_pad=0.5, pad=2.5)\n\n Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])\n Z = Z.reshape(xx.shape)\n cs = plt.contourf(xx, yy, Z, cmap=plt.cm.RdYlBu)\n\n plt.xlabel(iris.feature_names[pair[0]])\n plt.ylabel(iris.feature_names[pair[1]])\n\n # Plot the training points\n for i, color in zip(range(n_classes), plot_colors):\n idx = np.where(y == i)\n plt.scatter(X[idx, 0], X[idx, 1], c=color, label=iris.target_names[i],\n cmap=plt.cm.RdYlBu, edgecolor='black', s=15)\n\nplt.suptitle(\"Decision surface of a decision tree using paired features\")\nplt.legend(loc='lower right', borderpad=0, handletextpad=0)\nplt.axis(\"tight\")\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/plot_iris1.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
# Parameters
2424
n_classes = 3
25-
plot_colors = "bry"
25+
plot_colors = "ryb"
2626
plot_step = 0.02
2727

2828
# Load data
@@ -44,23 +44,22 @@
4444
y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
4545
xx, yy = np.meshgrid(np.arange(x_min, x_max, plot_step),
4646
np.arange(y_min, y_max, plot_step))
47+
plt.tight_layout(h_pad=0.5, w_pad=0.5, pad=2.5)
4748

4849
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
4950
Z = Z.reshape(xx.shape)
50-
cs = plt.contourf(xx, yy, Z, cmap=plt.cm.Paired)
51+
cs = plt.contourf(xx, yy, Z, cmap=plt.cm.RdYlBu)
5152

5253
plt.xlabel(iris.feature_names[pair[0]])
5354
plt.ylabel(iris.feature_names[pair[1]])
54-
plt.axis("tight")
5555

5656
# Plot the training points
5757
for i, color in zip(range(n_classes), plot_colors):
5858
idx = np.where(y == i)
5959
plt.scatter(X[idx, 0], X[idx, 1], c=color, label=iris.target_names[i],
60-
cmap=plt.cm.Paired)
61-
62-
plt.axis("tight")
60+
cmap=plt.cm.RdYlBu, edgecolor='black', s=15)
6361

6462
plt.suptitle("Decision surface of a decision tree using paired features")
65-
plt.legend()
63+
plt.legend(loc='lower right', borderpad=0, handletextpad=0)
64+
plt.axis("tight")
6665
plt.show()

dev/_downloads/scikit-learn-docs.pdf

12.1 KB
Binary file not shown.
1005 Bytes

0 commit comments

Comments
 (0)