Skip to content

Commit 710cf8f

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 5cdbbf15e3fade7cc2462ef66dc4ea0f37f390e3
1 parent 56ce94a commit 710cf8f

File tree

1,547 files changed

+6050
-6050
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,547 files changed

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

dev/_downloads/14f620cd922ca2c9a39ae5784034dd0d/plot_lda.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ def generate_data(n_samples, n_features):
9898
plt.legend(loc="lower left")
9999
plt.ylim((0.65, 1.0))
100100
plt.suptitle(
101-
"LDA (Linear Discriminant Analysis) vs. "
102-
+ "\n"
103-
+ "LDA with Ledoit Wolf vs. "
104-
+ "\n"
105-
+ "LDA with OAS (1 discriminative feature)"
101+
"LDA (Linear Discriminant Analysis) vs."
102+
"\n"
103+
"LDA with Ledoit Wolf vs."
104+
"\n"
105+
"LDA with OAS (1 discriminative feature)"
106106
)
107107
plt.show()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/2338f6e7d44c2931a41926d4f9726d9b/plot_linkage_comparison.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123
warnings.filterwarnings(
124124
"ignore",
125125
message="the number of connected components of the "
126-
+ "connectivity matrix is [0-9]{1,2}"
127-
+ " > 1. Completing it to avoid stopping the tree early.",
126+
"connectivity matrix is [0-9]{1,2}"
127+
" > 1. Completing it to avoid stopping the tree early.",
128128
category=UserWarning,
129129
)
130130
algorithm.fit(X)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/28df2114703b91f224d70205e9b75a7d/plot_concentration_prior.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: The scikit-learn developers\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib as mpl\nimport matplotlib.gridspec as gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.mixture import BayesianGaussianMixture\n\n\ndef plot_ellipses(ax, weights, means, covars):\n for n in range(means.shape[0]):\n eig_vals, eig_vecs = np.linalg.eigh(covars[n])\n unit_eig_vec = eig_vecs[0] / np.linalg.norm(eig_vecs[0])\n angle = np.arctan2(unit_eig_vec[1], unit_eig_vec[0])\n # Ellipse needs degrees\n angle = 180 * angle / np.pi\n # eigenvector normalization\n eig_vals = 2 * np.sqrt(2) * np.sqrt(eig_vals)\n ell = mpl.patches.Ellipse(\n means[n], eig_vals[0], eig_vals[1], angle=180 + angle, edgecolor=\"black\"\n )\n ell.set_clip_box(ax.bbox)\n ell.set_alpha(weights[n])\n ell.set_facecolor(\"#56B4E9\")\n ax.add_artist(ell)\n\n\ndef plot_results(ax1, ax2, estimator, X, y, title, plot_title=False):\n ax1.set_title(title)\n ax1.scatter(X[:, 0], X[:, 1], s=5, marker=\"o\", color=colors[y], alpha=0.8)\n ax1.set_xlim(-2.0, 2.0)\n ax1.set_ylim(-3.0, 3.0)\n ax1.set_xticks(())\n ax1.set_yticks(())\n plot_ellipses(ax1, estimator.weights_, estimator.means_, estimator.covariances_)\n\n ax2.get_xaxis().set_tick_params(direction=\"out\")\n ax2.yaxis.grid(True, alpha=0.7)\n for k, w in enumerate(estimator.weights_):\n ax2.bar(\n k,\n w,\n width=0.9,\n color=\"#56B4E9\",\n zorder=3,\n align=\"center\",\n edgecolor=\"black\",\n )\n ax2.text(k, w + 0.007, \"%.1f%%\" % (w * 100.0), horizontalalignment=\"center\")\n ax2.set_xlim(-0.6, 2 * n_components - 0.4)\n ax2.set_ylim(0.0, 1.1)\n ax2.tick_params(axis=\"y\", which=\"both\", left=False, right=False, labelleft=False)\n ax2.tick_params(axis=\"x\", which=\"both\", top=False)\n\n if plot_title:\n ax1.set_ylabel(\"Estimated Mixtures\")\n ax2.set_ylabel(\"Weight of each component\")\n\n\n# Parameters of the dataset\nrandom_state, n_components, n_features = 2, 3, 2\ncolors = np.array([\"#0072B2\", \"#F0E442\", \"#D55E00\"])\n\ncovars = np.array(\n [[[0.7, 0.0], [0.0, 0.1]], [[0.5, 0.0], [0.0, 0.1]], [[0.5, 0.0], [0.0, 0.1]]]\n)\nsamples = np.array([200, 500, 200])\nmeans = np.array([[0.0, -0.70], [0.0, 0.0], [0.0, 0.70]])\n\n# mean_precision_prior= 0.8 to minimize the influence of the prior\nestimators = [\n (\n \"Finite mixture with a Dirichlet distribution\\nprior and \" r\"$\\gamma_0=$\",\n BayesianGaussianMixture(\n weight_concentration_prior_type=\"dirichlet_distribution\",\n n_components=2 * n_components,\n reg_covar=0,\n init_params=\"random\",\n max_iter=1500,\n mean_precision_prior=0.8,\n random_state=random_state,\n ),\n [0.001, 1, 1000],\n ),\n (\n \"Infinite mixture with a Dirichlet process\\n prior and\" r\"$\\gamma_0=$\",\n BayesianGaussianMixture(\n weight_concentration_prior_type=\"dirichlet_process\",\n n_components=2 * n_components,\n reg_covar=0,\n init_params=\"random\",\n max_iter=1500,\n mean_precision_prior=0.8,\n random_state=random_state,\n ),\n [1, 1000, 100000],\n ),\n]\n\n# Generate data\nrng = np.random.RandomState(random_state)\nX = np.vstack(\n [\n rng.multivariate_normal(means[j], covars[j], samples[j])\n for j in range(n_components)\n ]\n)\ny = np.concatenate([np.full(samples[j], j, dtype=int) for j in range(n_components)])\n\n# Plot results in two different figures\nfor title, estimator, concentrations_prior in estimators:\n plt.figure(figsize=(4.7 * 3, 8))\n plt.subplots_adjust(\n bottom=0.04, top=0.90, hspace=0.05, wspace=0.05, left=0.03, right=0.99\n )\n\n gs = gridspec.GridSpec(3, len(concentrations_prior))\n for k, concentration in enumerate(concentrations_prior):\n estimator.weight_concentration_prior = concentration\n estimator.fit(X)\n plot_results(\n plt.subplot(gs[0:2, k]),\n plt.subplot(gs[2, k]),\n estimator,\n X,\n y,\n r\"%s$%.1e$\" % (title, concentration),\n plot_title=k == 0,\n )\n\nplt.show()"
18+
"# Authors: The scikit-learn developers\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib as mpl\nimport matplotlib.gridspec as gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.mixture import BayesianGaussianMixture\n\n\ndef plot_ellipses(ax, weights, means, covars):\n for n in range(means.shape[0]):\n eig_vals, eig_vecs = np.linalg.eigh(covars[n])\n unit_eig_vec = eig_vecs[0] / np.linalg.norm(eig_vecs[0])\n angle = np.arctan2(unit_eig_vec[1], unit_eig_vec[0])\n # Ellipse needs degrees\n angle = 180 * angle / np.pi\n # eigenvector normalization\n eig_vals = 2 * np.sqrt(2) * np.sqrt(eig_vals)\n ell = mpl.patches.Ellipse(\n means[n], eig_vals[0], eig_vals[1], angle=180 + angle, edgecolor=\"black\"\n )\n ell.set_clip_box(ax.bbox)\n ell.set_alpha(weights[n])\n ell.set_facecolor(\"#56B4E9\")\n ax.add_artist(ell)\n\n\ndef plot_results(ax1, ax2, estimator, X, y, title, plot_title=False):\n ax1.set_title(title)\n ax1.scatter(X[:, 0], X[:, 1], s=5, marker=\"o\", color=colors[y], alpha=0.8)\n ax1.set_xlim(-2.0, 2.0)\n ax1.set_ylim(-3.0, 3.0)\n ax1.set_xticks(())\n ax1.set_yticks(())\n plot_ellipses(ax1, estimator.weights_, estimator.means_, estimator.covariances_)\n\n ax2.get_xaxis().set_tick_params(direction=\"out\")\n ax2.yaxis.grid(True, alpha=0.7)\n for k, w in enumerate(estimator.weights_):\n ax2.bar(\n k,\n w,\n width=0.9,\n color=\"#56B4E9\",\n zorder=3,\n align=\"center\",\n edgecolor=\"black\",\n )\n ax2.text(k, w + 0.007, \"%.1f%%\" % (w * 100.0), horizontalalignment=\"center\")\n ax2.set_xlim(-0.6, 2 * n_components - 0.4)\n ax2.set_ylim(0.0, 1.1)\n ax2.tick_params(axis=\"y\", which=\"both\", left=False, right=False, labelleft=False)\n ax2.tick_params(axis=\"x\", which=\"both\", top=False)\n\n if plot_title:\n ax1.set_ylabel(\"Estimated Mixtures\")\n ax2.set_ylabel(\"Weight of each component\")\n\n\n# Parameters of the dataset\nrandom_state, n_components, n_features = 2, 3, 2\ncolors = np.array([\"#0072B2\", \"#F0E442\", \"#D55E00\"])\n\ncovars = np.array(\n [[[0.7, 0.0], [0.0, 0.1]], [[0.5, 0.0], [0.0, 0.1]], [[0.5, 0.0], [0.0, 0.1]]]\n)\nsamples = np.array([200, 500, 200])\nmeans = np.array([[0.0, -0.70], [0.0, 0.0], [0.0, 0.70]])\n\n# mean_precision_prior= 0.8 to minimize the influence of the prior\nestimators = [\n (\n \"Finite mixture with a Dirichlet distribution\\n\" r\"prior and $\\gamma_0=$\",\n BayesianGaussianMixture(\n weight_concentration_prior_type=\"dirichlet_distribution\",\n n_components=2 * n_components,\n reg_covar=0,\n init_params=\"random\",\n max_iter=1500,\n mean_precision_prior=0.8,\n random_state=random_state,\n ),\n [0.001, 1, 1000],\n ),\n (\n \"Infinite mixture with a Dirichlet process\\n\" r\"prior and $\\gamma_0=$\",\n BayesianGaussianMixture(\n weight_concentration_prior_type=\"dirichlet_process\",\n n_components=2 * n_components,\n reg_covar=0,\n init_params=\"random\",\n max_iter=1500,\n mean_precision_prior=0.8,\n random_state=random_state,\n ),\n [1, 1000, 100000],\n ),\n]\n\n# Generate data\nrng = np.random.RandomState(random_state)\nX = np.vstack(\n [\n rng.multivariate_normal(means[j], covars[j], samples[j])\n for j in range(n_components)\n ]\n)\ny = np.concatenate([np.full(samples[j], j, dtype=int) for j in range(n_components)])\n\n# Plot results in two different figures\nfor title, estimator, concentrations_prior in estimators:\n plt.figure(figsize=(4.7 * 3, 8))\n plt.subplots_adjust(\n bottom=0.04, top=0.90, hspace=0.05, wspace=0.05, left=0.03, right=0.99\n )\n\n gs = gridspec.GridSpec(3, len(concentrations_prior))\n for k, concentration in enumerate(concentrations_prior):\n estimator.weight_concentration_prior = concentration\n estimator.fit(X)\n plot_results(\n plt.subplot(gs[0:2, k]),\n plt.subplot(gs[2, k]),\n estimator,\n X,\n y,\n r\"%s$%.1e$\" % (title, concentration),\n plot_title=k == 0,\n )\n\nplt.show()"
1919
]
2020
}
2121
],
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/803ca1bcd8dd2c364836a6784144355b/plot_cluster_comparison.ipynb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/ac9ba06dbb8ef65d14cff69663ec06f2/plot_concentration_prior.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def plot_results(ax1, ax2, estimator, X, y, title, plot_title=False):
103103
# mean_precision_prior= 0.8 to minimize the influence of the prior
104104
estimators = [
105105
(
106-
"Finite mixture with a Dirichlet distribution\nprior and " r"$\gamma_0=$",
106+
"Finite mixture with a Dirichlet distribution\n" r"prior and $\gamma_0=$",
107107
BayesianGaussianMixture(
108108
weight_concentration_prior_type="dirichlet_distribution",
109109
n_components=2 * n_components,
@@ -116,7 +116,7 @@ def plot_results(ax1, ax2, estimator, X, y, title, plot_title=False):
116116
[0.001, 1, 1000],
117117
),
118118
(
119-
"Infinite mixture with a Dirichlet process\n prior and" r"$\gamma_0=$",
119+
"Infinite mixture with a Dirichlet process\n" r"prior and $\gamma_0=$",
120120
BayesianGaussianMixture(
121121
weight_concentration_prior_type="dirichlet_process",
122122
n_components=2 * n_components,

dev/_downloads/acc912c1f80e1cb0e32675b5f7686075/plot_lda.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: The scikit-learn developers\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.covariance import OAS\nfrom sklearn.datasets import make_blobs\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n\nn_train = 20 # samples for training\nn_test = 200 # samples for testing\nn_averages = 50 # how often to repeat classification\nn_features_max = 75 # maximum number of features\nstep = 4 # step size for the calculation\n\n\ndef generate_data(n_samples, n_features):\n \"\"\"Generate random blob-ish data with noisy features.\n\n This returns an array of input data with shape `(n_samples, n_features)`\n and an array of `n_samples` target labels.\n\n Only one feature contains discriminative information, the other features\n contain only noise.\n \"\"\"\n X, y = make_blobs(n_samples=n_samples, n_features=1, centers=[[-2], [2]])\n\n # add non-discriminative features\n if n_features > 1:\n X = np.hstack([X, np.random.randn(n_samples, n_features - 1)])\n return X, y\n\n\nacc_clf1, acc_clf2, acc_clf3 = [], [], []\nn_features_range = range(1, n_features_max + 1, step)\nfor n_features in n_features_range:\n score_clf1, score_clf2, score_clf3 = 0, 0, 0\n for _ in range(n_averages):\n X, y = generate_data(n_train, n_features)\n\n clf1 = LinearDiscriminantAnalysis(solver=\"lsqr\", shrinkage=None).fit(X, y)\n clf2 = LinearDiscriminantAnalysis(solver=\"lsqr\", shrinkage=\"auto\").fit(X, y)\n oa = OAS(store_precision=False, assume_centered=False)\n clf3 = LinearDiscriminantAnalysis(solver=\"lsqr\", covariance_estimator=oa).fit(\n X, y\n )\n\n X, y = generate_data(n_test, n_features)\n score_clf1 += clf1.score(X, y)\n score_clf2 += clf2.score(X, y)\n score_clf3 += clf3.score(X, y)\n\n acc_clf1.append(score_clf1 / n_averages)\n acc_clf2.append(score_clf2 / n_averages)\n acc_clf3.append(score_clf3 / n_averages)\n\nfeatures_samples_ratio = np.array(n_features_range) / n_train\n\nplt.plot(\n features_samples_ratio,\n acc_clf1,\n linewidth=2,\n label=\"LDA\",\n color=\"gold\",\n linestyle=\"solid\",\n)\nplt.plot(\n features_samples_ratio,\n acc_clf2,\n linewidth=2,\n label=\"LDA with Ledoit Wolf\",\n color=\"navy\",\n linestyle=\"dashed\",\n)\nplt.plot(\n features_samples_ratio,\n acc_clf3,\n linewidth=2,\n label=\"LDA with OAS\",\n color=\"red\",\n linestyle=\"dotted\",\n)\n\nplt.xlabel(\"n_features / n_samples\")\nplt.ylabel(\"Classification accuracy\")\n\nplt.legend(loc=\"lower left\")\nplt.ylim((0.65, 1.0))\nplt.suptitle(\n \"LDA (Linear Discriminant Analysis) vs. \"\n + \"\\n\"\n + \"LDA with Ledoit Wolf vs. \"\n + \"\\n\"\n + \"LDA with OAS (1 discriminative feature)\"\n)\nplt.show()"
18+
"# Authors: The scikit-learn developers\n# SPDX-License-Identifier: BSD-3-Clause\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.covariance import OAS\nfrom sklearn.datasets import make_blobs\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n\nn_train = 20 # samples for training\nn_test = 200 # samples for testing\nn_averages = 50 # how often to repeat classification\nn_features_max = 75 # maximum number of features\nstep = 4 # step size for the calculation\n\n\ndef generate_data(n_samples, n_features):\n \"\"\"Generate random blob-ish data with noisy features.\n\n This returns an array of input data with shape `(n_samples, n_features)`\n and an array of `n_samples` target labels.\n\n Only one feature contains discriminative information, the other features\n contain only noise.\n \"\"\"\n X, y = make_blobs(n_samples=n_samples, n_features=1, centers=[[-2], [2]])\n\n # add non-discriminative features\n if n_features > 1:\n X = np.hstack([X, np.random.randn(n_samples, n_features - 1)])\n return X, y\n\n\nacc_clf1, acc_clf2, acc_clf3 = [], [], []\nn_features_range = range(1, n_features_max + 1, step)\nfor n_features in n_features_range:\n score_clf1, score_clf2, score_clf3 = 0, 0, 0\n for _ in range(n_averages):\n X, y = generate_data(n_train, n_features)\n\n clf1 = LinearDiscriminantAnalysis(solver=\"lsqr\", shrinkage=None).fit(X, y)\n clf2 = LinearDiscriminantAnalysis(solver=\"lsqr\", shrinkage=\"auto\").fit(X, y)\n oa = OAS(store_precision=False, assume_centered=False)\n clf3 = LinearDiscriminantAnalysis(solver=\"lsqr\", covariance_estimator=oa).fit(\n X, y\n )\n\n X, y = generate_data(n_test, n_features)\n score_clf1 += clf1.score(X, y)\n score_clf2 += clf2.score(X, y)\n score_clf3 += clf3.score(X, y)\n\n acc_clf1.append(score_clf1 / n_averages)\n acc_clf2.append(score_clf2 / n_averages)\n acc_clf3.append(score_clf3 / n_averages)\n\nfeatures_samples_ratio = np.array(n_features_range) / n_train\n\nplt.plot(\n features_samples_ratio,\n acc_clf1,\n linewidth=2,\n label=\"LDA\",\n color=\"gold\",\n linestyle=\"solid\",\n)\nplt.plot(\n features_samples_ratio,\n acc_clf2,\n linewidth=2,\n label=\"LDA with Ledoit Wolf\",\n color=\"navy\",\n linestyle=\"dashed\",\n)\nplt.plot(\n features_samples_ratio,\n acc_clf3,\n linewidth=2,\n label=\"LDA with OAS\",\n color=\"red\",\n linestyle=\"dotted\",\n)\n\nplt.xlabel(\"n_features / n_samples\")\nplt.ylabel(\"Classification accuracy\")\n\nplt.legend(loc=\"lower left\")\nplt.ylim((0.65, 1.0))\nplt.suptitle(\n \"LDA (Linear Discriminant Analysis) vs.\"\n \"\\n\"\n \"LDA with Ledoit Wolf vs.\"\n \"\\n\"\n \"LDA with OAS (1 discriminative feature)\"\n)\nplt.show()"
1919
]
2020
}
2121
],
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)