Skip to content

Commit 63e5a5e

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 55ca335e4202c9e301cd82d8fdc9b75e7df7f76c
1 parent ec7f039 commit 63e5a5e

File tree

1,820 files changed

+7039
-7039
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,820 files changed

+7039
-7039
lines changed

dev/_downloads/006fc185672e58b056a5c134db26935c/plot_coin_segmentation.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-
"# Author: Gael Varoquaux <[email protected]>\n# Brian Cheung\n# Andrew Knyazev <[email protected]>\n# License: BSD 3 clause\n\nimport time\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.ndimage import gaussian_filter\nfrom skimage.data import coins\nfrom skimage.transform import rescale\n\nfrom sklearn.cluster import spectral_clustering\nfrom sklearn.feature_extraction import image\n\n# load the coins as a numpy array\norig_coins = coins()\n\n# Resize it to 20% of the original size to speed up the processing\n# Applying a Gaussian filter for smoothing prior to down-scaling\n# reduces aliasing artifacts.\nsmoothened_coins = gaussian_filter(orig_coins, sigma=2)\nrescaled_coins = rescale(smoothened_coins, 0.2, mode=\"reflect\", anti_aliasing=False)\n\n# Convert the image into a graph with the value of the gradient on the\n# edges.\ngraph = image.img_to_graph(rescaled_coins)\n\n# Take a decreasing function of the gradient: an exponential\n# The smaller beta is, the more independent the segmentation is of the\n# actual image. For beta=1, the segmentation is close to a voronoi\nbeta = 10\neps = 1e-6\ngraph.data = np.exp(-beta * graph.data / graph.data.std()) + eps\n\n# The number of segmented regions to display needs to be chosen manually.\n# The current version of 'spectral_clustering' does not support determining\n# the number of good quality clusters automatically.\nn_regions = 26"
18+
"# Author: Gael Varoquaux <[email protected]>\n# Brian Cheung\n# Andrew Knyazev <[email protected]>\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport time\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.ndimage import gaussian_filter\nfrom skimage.data import coins\nfrom skimage.transform import rescale\n\nfrom sklearn.cluster import spectral_clustering\nfrom sklearn.feature_extraction import image\n\n# load the coins as a numpy array\norig_coins = coins()\n\n# Resize it to 20% of the original size to speed up the processing\n# Applying a Gaussian filter for smoothing prior to down-scaling\n# reduces aliasing artifacts.\nsmoothened_coins = gaussian_filter(orig_coins, sigma=2)\nrescaled_coins = rescale(smoothened_coins, 0.2, mode=\"reflect\", anti_aliasing=False)\n\n# Convert the image into a graph with the value of the gradient on the\n# edges.\ngraph = image.img_to_graph(rescaled_coins)\n\n# Take a decreasing function of the gradient: an exponential\n# The smaller beta is, the more independent the segmentation is of the\n# actual image. For beta=1, the segmentation is close to a voronoi\nbeta = 10\neps = 1e-6\ngraph.data = np.exp(-beta * graph.data / graph.data.std()) + eps\n\n# The number of segmented regions to display needs to be chosen manually.\n# The current version of 'spectral_clustering' does not support determining\n# the number of good quality clusters automatically.\nn_regions = 26"
1919
]
2020
},
2121
{

dev/_downloads/01fdc7c95204e4a420de7cd297711693/plot_feature_union.py

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

1919
# Author: Andreas Mueller <[email protected]>
2020
#
21-
# License: BSD 3 clause
21+
# SPDX-License-Identifier: BSD-3-Clause
2222

2323
from sklearn.datasets import load_iris
2424
from sklearn.decomposition import PCA

dev/_downloads/023324c27491610e7c0ccff87c59abf9/plot_kernel_pca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Authors: Mathieu Blondel
2020
# Andreas Mueller
2121
# Guillaume Lemaitre
22-
# License: BSD 3 clause
22+
# SPDX-License-Identifier: BSD-3-Clause
2323

2424
# %%
2525
# Projecting data: `PCA` vs. `KernelPCA`

dev/_downloads/02a1306a494b46cc56c930ceec6e8c4a/plot_species_kde.py

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

3939
# Author: Jake Vanderplas <[email protected]>
4040
#
41-
# License: BSD 3 clause
41+
# SPDX-License-Identifier: BSD-3-Clause
4242

4343
import matplotlib.pyplot as plt
4444
import numpy as np

dev/_downloads/02f111fb3dd79805b161e14c564184fc/plot_sgd_comparison.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-
"# Author: Rob Zinkov <rob at zinkov dot com>\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn import datasets\nfrom sklearn.linear_model import (\n LogisticRegression,\n PassiveAggressiveClassifier,\n Perceptron,\n SGDClassifier,\n)\nfrom sklearn.model_selection import train_test_split\n\nheldout = [0.95, 0.90, 0.75, 0.50, 0.01]\n# Number of rounds to fit and evaluate an estimator.\nrounds = 10\nX, y = datasets.load_digits(return_X_y=True)\n\nclassifiers = [\n (\"SGD\", SGDClassifier(max_iter=110)),\n (\"ASGD\", SGDClassifier(max_iter=110, average=True)),\n (\"Perceptron\", Perceptron(max_iter=110)),\n (\n \"Passive-Aggressive I\",\n PassiveAggressiveClassifier(max_iter=110, loss=\"hinge\", C=1.0, tol=1e-4),\n ),\n (\n \"Passive-Aggressive II\",\n PassiveAggressiveClassifier(\n max_iter=110, loss=\"squared_hinge\", C=1.0, tol=1e-4\n ),\n ),\n (\n \"SAG\",\n LogisticRegression(max_iter=110, solver=\"sag\", tol=1e-1, C=1.0e4 / X.shape[0]),\n ),\n]\n\nxx = 1.0 - 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 = train_test_split(\n X, y, test_size=i, random_state=rng\n )\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()"
18+
"# Author: Rob Zinkov <rob at zinkov dot com>\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn import datasets\nfrom sklearn.linear_model import (\n LogisticRegression,\n PassiveAggressiveClassifier,\n Perceptron,\n SGDClassifier,\n)\nfrom sklearn.model_selection import train_test_split\n\nheldout = [0.95, 0.90, 0.75, 0.50, 0.01]\n# Number of rounds to fit and evaluate an estimator.\nrounds = 10\nX, y = datasets.load_digits(return_X_y=True)\n\nclassifiers = [\n (\"SGD\", SGDClassifier(max_iter=110)),\n (\"ASGD\", SGDClassifier(max_iter=110, average=True)),\n (\"Perceptron\", Perceptron(max_iter=110)),\n (\n \"Passive-Aggressive I\",\n PassiveAggressiveClassifier(max_iter=110, loss=\"hinge\", C=1.0, tol=1e-4),\n ),\n (\n \"Passive-Aggressive II\",\n PassiveAggressiveClassifier(\n max_iter=110, loss=\"squared_hinge\", C=1.0, tol=1e-4\n ),\n ),\n (\n \"SAG\",\n LogisticRegression(max_iter=110, solver=\"sag\", tol=1e-1, C=1.0e4 / X.shape[0]),\n ),\n]\n\nxx = 1.0 - 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 = train_test_split(\n X, y, test_size=i, random_state=rng\n )\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()"
1919
]
2020
}
2121
],

dev/_downloads/05ca8a4e90b4cc2acd69f9e24b4a1f3a/plot_classifier_chain_yeast.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-
"# Author: Adam Kleczewski\n# License: BSD 3 clause"
18+
"# Author: Adam Kleczewski\n# SPDX-License-Identifier: BSD-3-Clause"
1919
]
2020
},
2121
{

dev/_downloads/06cfc926acb27652fb2aa5bfc583e7cb/plot_hashing_vs_dict_vectorizer.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-
"# Author: Lars Buitinck\n# Olivier Grisel <[email protected]>\n# Arturo Amor <[email protected]>\n# License: BSD 3 clause"
18+
"# Author: Lars Buitinck\n# Olivier Grisel <[email protected]>\n# Arturo Amor <[email protected]>\n# SPDX-License-Identifier: BSD-3-Clause"
1919
]
2020
},
2121
{

dev/_downloads/07960f9087d379e9d0da6350d6ee3f41/plot_classification_probability.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-
"# Author: Alexandre Gramfort <[email protected]>\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom matplotlib import cm\n\nfrom sklearn import datasets\nfrom sklearn.gaussian_process import GaussianProcessClassifier\nfrom sklearn.gaussian_process.kernels import RBF\nfrom sklearn.inspection import DecisionBoundaryDisplay\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.multiclass import OneVsRestClassifier\nfrom sklearn.svm import SVC\n\niris = datasets.load_iris()\nX = iris.data[:, 0:2] # we only take the first two features for visualization\ny = iris.target\n\nn_features = X.shape[1]\n\nC = 10\nkernel = 1.0 * RBF([1.0, 1.0]) # for GPC\n\n# Create different classifiers.\nclassifiers = {\n \"L1 logistic\": LogisticRegression(C=C, penalty=\"l1\", solver=\"saga\", max_iter=10000),\n \"L2 logistic (Multinomial)\": LogisticRegression(\n C=C, penalty=\"l2\", solver=\"saga\", max_iter=10000\n ),\n \"L2 logistic (OvR)\": OneVsRestClassifier(\n LogisticRegression(C=C, penalty=\"l2\", solver=\"saga\", max_iter=10000)\n ),\n \"Linear SVC\": SVC(kernel=\"linear\", C=C, probability=True, random_state=0),\n \"GPC\": GaussianProcessClassifier(kernel),\n}\n\nn_classifiers = len(classifiers)\n\nfig, axes = plt.subplots(\n nrows=n_classifiers,\n ncols=len(iris.target_names),\n figsize=(3 * 2, n_classifiers * 2),\n)\nfor classifier_idx, (name, classifier) in enumerate(classifiers.items()):\n y_pred = classifier.fit(X, y).predict(X)\n accuracy = accuracy_score(y, y_pred)\n print(f\"Accuracy (train) for {name}: {accuracy:0.1%}\")\n for label in np.unique(y):\n # plot the probability estimate provided by the classifier\n disp = DecisionBoundaryDisplay.from_estimator(\n classifier,\n X,\n response_method=\"predict_proba\",\n class_of_interest=label,\n ax=axes[classifier_idx, label],\n vmin=0,\n vmax=1,\n )\n axes[classifier_idx, label].set_title(f\"Class {label}\")\n # plot data predicted to belong to given class\n mask_y_pred = y_pred == label\n axes[classifier_idx, label].scatter(\n X[mask_y_pred, 0], X[mask_y_pred, 1], marker=\"o\", c=\"w\", edgecolor=\"k\"\n )\n axes[classifier_idx, label].set(xticks=(), yticks=())\n axes[classifier_idx, 0].set_ylabel(name)\n\nax = plt.axes([0.15, 0.04, 0.7, 0.02])\nplt.title(\"Probability\")\n_ = plt.colorbar(\n cm.ScalarMappable(norm=None, cmap=\"viridis\"), cax=ax, orientation=\"horizontal\"\n)\n\nplt.show()"
18+
"# Author: Alexandre Gramfort <[email protected]>\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom matplotlib import cm\n\nfrom sklearn import datasets\nfrom sklearn.gaussian_process import GaussianProcessClassifier\nfrom sklearn.gaussian_process.kernels import RBF\nfrom sklearn.inspection import DecisionBoundaryDisplay\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.multiclass import OneVsRestClassifier\nfrom sklearn.svm import SVC\n\niris = datasets.load_iris()\nX = iris.data[:, 0:2] # we only take the first two features for visualization\ny = iris.target\n\nn_features = X.shape[1]\n\nC = 10\nkernel = 1.0 * RBF([1.0, 1.0]) # for GPC\n\n# Create different classifiers.\nclassifiers = {\n \"L1 logistic\": LogisticRegression(C=C, penalty=\"l1\", solver=\"saga\", max_iter=10000),\n \"L2 logistic (Multinomial)\": LogisticRegression(\n C=C, penalty=\"l2\", solver=\"saga\", max_iter=10000\n ),\n \"L2 logistic (OvR)\": OneVsRestClassifier(\n LogisticRegression(C=C, penalty=\"l2\", solver=\"saga\", max_iter=10000)\n ),\n \"Linear SVC\": SVC(kernel=\"linear\", C=C, probability=True, random_state=0),\n \"GPC\": GaussianProcessClassifier(kernel),\n}\n\nn_classifiers = len(classifiers)\n\nfig, axes = plt.subplots(\n nrows=n_classifiers,\n ncols=len(iris.target_names),\n figsize=(3 * 2, n_classifiers * 2),\n)\nfor classifier_idx, (name, classifier) in enumerate(classifiers.items()):\n y_pred = classifier.fit(X, y).predict(X)\n accuracy = accuracy_score(y, y_pred)\n print(f\"Accuracy (train) for {name}: {accuracy:0.1%}\")\n for label in np.unique(y):\n # plot the probability estimate provided by the classifier\n disp = DecisionBoundaryDisplay.from_estimator(\n classifier,\n X,\n response_method=\"predict_proba\",\n class_of_interest=label,\n ax=axes[classifier_idx, label],\n vmin=0,\n vmax=1,\n )\n axes[classifier_idx, label].set_title(f\"Class {label}\")\n # plot data predicted to belong to given class\n mask_y_pred = y_pred == label\n axes[classifier_idx, label].scatter(\n X[mask_y_pred, 0], X[mask_y_pred, 1], marker=\"o\", c=\"w\", edgecolor=\"k\"\n )\n axes[classifier_idx, label].set(xticks=(), yticks=())\n axes[classifier_idx, 0].set_ylabel(name)\n\nax = plt.axes([0.15, 0.04, 0.7, 0.02])\nplt.title(\"Probability\")\n_ = plt.colorbar(\n cm.ScalarMappable(norm=None, cmap=\"viridis\"), cax=ax, orientation=\"horizontal\"\n)\n\nplt.show()"
1919
]
2020
}
2121
],
Binary file not shown.

dev/_downloads/083d8568c199bebbc1a847fc6c917e9e/plot_kernel_approximation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"outputs": [],
2424
"source": [
25-
"# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>\n# Andreas Mueller <[email protected]>\n# License: BSD 3 clause\n\n# Standard scientific Python imports\nfrom time import time\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Import datasets, classifiers and performance metrics\nfrom sklearn import datasets, pipeline, svm\nfrom sklearn.decomposition import PCA\nfrom sklearn.kernel_approximation import Nystroem, RBFSampler\n\n# The digits dataset\ndigits = datasets.load_digits(n_class=9)"
25+
"# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>\n# Andreas Mueller <[email protected]>\n# SPDX-License-Identifier: BSD-3-Clause\n\n# Standard scientific Python imports\nfrom time import time\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Import datasets, classifiers and performance metrics\nfrom sklearn import datasets, pipeline, svm\nfrom sklearn.decomposition import PCA\nfrom sklearn.kernel_approximation import Nystroem, RBFSampler\n\n# The digits dataset\ndigits = datasets.load_digits(n_class=9)"
2626
]
2727
},
2828
{

dev/_downloads/08fc4f471ae40388eb535678346dc9d1/plot_gpc_xor.py

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

1414
# Authors: Jan Hendrik Metzen <[email protected]>
1515
#
16-
# License: BSD 3 clause
16+
# SPDX-License-Identifier: BSD-3-Clause
1717

1818
import matplotlib.pyplot as plt
1919
import numpy as np

dev/_downloads/091282551e0bf11fedc96b869dfa8408/plot_grid_search_text_feature_extraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Peter Prettenhofer <[email protected]>
1919
# Mathieu Blondel <[email protected]>
2020
# Arturo Amor <[email protected]>
21-
# License: BSD 3 clause
21+
# SPDX-License-Identifier: BSD-3-Clause
2222

2323
# %%
2424
# Data loading

dev/_downloads/09c15b8ca914c1951a06a9ce3431460f/plot_ols_ridge_variance.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-
"# Code source: Ga\u00ebl Varoquaux\n# Modified for documentation by Jaques Grobler\n# License: BSD 3 clause\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn import linear_model\n\nX_train = np.c_[0.5, 1].T\ny_train = [0.5, 1]\nX_test = np.c_[0, 2].T\n\nnp.random.seed(0)\n\nclassifiers = dict(\n ols=linear_model.LinearRegression(), ridge=linear_model.Ridge(alpha=0.1)\n)\n\nfor name, clf in classifiers.items():\n fig, ax = plt.subplots(figsize=(4, 3))\n\n for _ in range(6):\n this_X = 0.1 * np.random.normal(size=(2, 1)) + X_train\n clf.fit(this_X, y_train)\n\n ax.plot(X_test, clf.predict(X_test), color=\"gray\")\n ax.scatter(this_X, y_train, s=3, c=\"gray\", marker=\"o\", zorder=10)\n\n clf.fit(X_train, y_train)\n ax.plot(X_test, clf.predict(X_test), linewidth=2, color=\"blue\")\n ax.scatter(X_train, y_train, s=30, c=\"red\", marker=\"+\", zorder=10)\n\n ax.set_title(name)\n ax.set_xlim(0, 2)\n ax.set_ylim((0, 1.6))\n ax.set_xlabel(\"X\")\n ax.set_ylabel(\"y\")\n\n fig.tight_layout()\n\nplt.show()"
18+
"# Code source: Ga\u00ebl Varoquaux\n# Modified for documentation by Jaques Grobler\n# SPDX-License-Identifier: BSD-3-Clause\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn import linear_model\n\nX_train = np.c_[0.5, 1].T\ny_train = [0.5, 1]\nX_test = np.c_[0, 2].T\n\nnp.random.seed(0)\n\nclassifiers = dict(\n ols=linear_model.LinearRegression(), ridge=linear_model.Ridge(alpha=0.1)\n)\n\nfor name, clf in classifiers.items():\n fig, ax = plt.subplots(figsize=(4, 3))\n\n for _ in range(6):\n this_X = 0.1 * np.random.normal(size=(2, 1)) + X_train\n clf.fit(this_X, y_train)\n\n ax.plot(X_test, clf.predict(X_test), color=\"gray\")\n ax.scatter(this_X, y_train, s=3, c=\"gray\", marker=\"o\", zorder=10)\n\n clf.fit(X_train, y_train)\n ax.plot(X_test, clf.predict(X_test), linewidth=2, color=\"blue\")\n ax.scatter(X_train, y_train, s=30, c=\"red\", marker=\"+\", zorder=10)\n\n ax.set_title(name)\n ax.set_xlim(0, 2)\n ax.set_ylim((0, 1.6))\n ax.set_xlabel(\"X\")\n ax.set_ylabel(\"y\")\n\n fig.tight_layout()\n\nplt.show()"
1919
]
2020
}
2121
],

0 commit comments

Comments
 (0)