Skip to content

Commit aed330a

Browse files
committed
Pushing the docs to dev/ for branch: main, commit e41753ebd57c44ae91b389f190c43ddc0b384a75
1 parent fadfb35 commit aed330a

File tree

1,249 files changed

+4378
-4543
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,249 files changed

+4378
-4543
lines changed
Binary file not shown.

dev/_downloads/51833337bfc73d152b44902e5baa50ff/plot_lasso_lars_ic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
},
6363
"outputs": [],
6464
"source": [
65-
"from sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LassoLarsIC\nfrom sklearn.pipeline import make_pipeline\n\nlasso_lars_ic = make_pipeline(\n StandardScaler(), LassoLarsIC(criterion=\"aic\", normalize=False)\n).fit(X, y)"
65+
"from sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LassoLarsIC\nfrom sklearn.pipeline import make_pipeline\n\nlasso_lars_ic = make_pipeline(StandardScaler(), LassoLarsIC(criterion=\"aic\")).fit(X, y)"
6666
]
6767
},
6868
{

dev/_downloads/58580795dd881384f33e7e6492e154e2/plot_lasso_model_selection.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@
6464
from sklearn.pipeline import make_pipeline
6565

6666
start_time = time.time()
67-
lasso_lars_ic = make_pipeline(
68-
StandardScaler(), LassoLarsIC(criterion="aic", normalize=False)
69-
).fit(X, y)
67+
lasso_lars_ic = make_pipeline(StandardScaler(), LassoLarsIC(criterion="aic")).fit(X, y)
7068
fit_time = time.time() - start_time
7169

7270
# %%
@@ -193,7 +191,7 @@ def highlight_min(x):
193191
from sklearn.linear_model import LassoLarsCV
194192

195193
start_time = time.time()
196-
model = make_pipeline(StandardScaler(), LassoLarsCV(cv=20, normalize=False)).fit(X, y)
194+
model = make_pipeline(StandardScaler(), LassoLarsCV(cv=20)).fit(X, y)
197195
fit_time = time.time() - start_time
198196

199197
# %%
Binary file not shown.

dev/_downloads/8c96d910ed5b614924f36c896b1934a6/plot_lasso_lars_ic.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
from sklearn.linear_model import LassoLarsIC
5050
from sklearn.pipeline import make_pipeline
5151

52-
lasso_lars_ic = make_pipeline(
53-
StandardScaler(), LassoLarsIC(criterion="aic", normalize=False)
54-
).fit(X, y)
52+
lasso_lars_ic = make_pipeline(StandardScaler(), LassoLarsIC(criterion="aic")).fit(X, y)
5553

5654

5755
# %%

dev/_downloads/901ad159d788e1122a5616f537985e74/plot_lasso_model_selection.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"import time\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LassoLarsIC\nfrom sklearn.pipeline import make_pipeline\n\nstart_time = time.time()\nlasso_lars_ic = make_pipeline(\n StandardScaler(), LassoLarsIC(criterion=\"aic\", normalize=False)\n).fit(X, y)\nfit_time = time.time() - start_time"
83+
"import time\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LassoLarsIC\nfrom sklearn.pipeline import make_pipeline\n\nstart_time = time.time()\nlasso_lars_ic = make_pipeline(StandardScaler(), LassoLarsIC(criterion=\"aic\")).fit(X, y)\nfit_time = time.time() - start_time"
8484
]
8585
},
8686
{
@@ -199,7 +199,7 @@
199199
},
200200
"outputs": [],
201201
"source": [
202-
"from sklearn.linear_model import LassoLarsCV\n\nstart_time = time.time()\nmodel = make_pipeline(StandardScaler(), LassoLarsCV(cv=20, normalize=False)).fit(X, y)\nfit_time = time.time() - start_time"
202+
"from sklearn.linear_model import LassoLarsCV\n\nstart_time = time.time()\nmodel = make_pipeline(StandardScaler(), LassoLarsCV(cv=20)).fit(X, y)\nfit_time = time.time() - start_time"
203203
]
204204
},
205205
{

dev/_downloads/9b5ca5a413df494778642d75caeb33d7/plot_omp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
plt.stem(idx, w[idx], use_line_collection=True)
4545

4646
# plot the noise-free reconstruction
47-
omp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_nonzero_coefs, normalize=False)
47+
omp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_nonzero_coefs)
4848
omp.fit(X, y)
4949
coef = omp.coef_
5050
(idx_r,) = coef.nonzero()
@@ -63,7 +63,7 @@
6363
plt.stem(idx_r, coef[idx_r], use_line_collection=True)
6464

6565
# plot the noisy reconstruction with number of non-zeros set by CV
66-
omp_cv = OrthogonalMatchingPursuitCV(normalize=False)
66+
omp_cv = OrthogonalMatchingPursuitCV()
6767
omp_cv.fit(X, y_noisy)
6868
coef = omp_cv.coef_
6969
(idx_r,) = coef.nonzero()

dev/_downloads/a79c521bd835e8739e06d7dafbfc4eb4/plot_omp.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-
"import matplotlib.pyplot as plt\nimport numpy as np\nfrom sklearn.linear_model import OrthogonalMatchingPursuit\nfrom sklearn.linear_model import OrthogonalMatchingPursuitCV\nfrom sklearn.datasets import make_sparse_coded_signal\n\nn_components, n_features = 512, 100\nn_nonzero_coefs = 17\n\n# generate the data\n\n# y = Xw\n# |x|_0 = n_nonzero_coefs\n\ny, X, w = make_sparse_coded_signal(\n n_samples=1,\n n_components=n_components,\n n_features=n_features,\n n_nonzero_coefs=n_nonzero_coefs,\n random_state=0,\n data_transposed=True,\n)\n\n(idx,) = w.nonzero()\n\n# distort the clean signal\ny_noisy = y + 0.05 * np.random.randn(len(y))\n\n# plot the sparse signal\nplt.figure(figsize=(7, 7))\nplt.subplot(4, 1, 1)\nplt.xlim(0, 512)\nplt.title(\"Sparse signal\")\nplt.stem(idx, w[idx], use_line_collection=True)\n\n# plot the noise-free reconstruction\nomp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_nonzero_coefs, normalize=False)\nomp.fit(X, y)\ncoef = omp.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 2)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noise-free measurements\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\n# plot the noisy reconstruction\nomp.fit(X, y_noisy)\ncoef = omp.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 3)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noisy measurements\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\n# plot the noisy reconstruction with number of non-zeros set by CV\nomp_cv = OrthogonalMatchingPursuitCV(normalize=False)\nomp_cv.fit(X, y_noisy)\ncoef = omp_cv.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 4)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noisy measurements with CV\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\nplt.subplots_adjust(0.06, 0.04, 0.94, 0.90, 0.20, 0.38)\nplt.suptitle(\"Sparse signal recovery with Orthogonal Matching Pursuit\", fontsize=16)\nplt.show()"
29+
"import matplotlib.pyplot as plt\nimport numpy as np\nfrom sklearn.linear_model import OrthogonalMatchingPursuit\nfrom sklearn.linear_model import OrthogonalMatchingPursuitCV\nfrom sklearn.datasets import make_sparse_coded_signal\n\nn_components, n_features = 512, 100\nn_nonzero_coefs = 17\n\n# generate the data\n\n# y = Xw\n# |x|_0 = n_nonzero_coefs\n\ny, X, w = make_sparse_coded_signal(\n n_samples=1,\n n_components=n_components,\n n_features=n_features,\n n_nonzero_coefs=n_nonzero_coefs,\n random_state=0,\n data_transposed=True,\n)\n\n(idx,) = w.nonzero()\n\n# distort the clean signal\ny_noisy = y + 0.05 * np.random.randn(len(y))\n\n# plot the sparse signal\nplt.figure(figsize=(7, 7))\nplt.subplot(4, 1, 1)\nplt.xlim(0, 512)\nplt.title(\"Sparse signal\")\nplt.stem(idx, w[idx], use_line_collection=True)\n\n# plot the noise-free reconstruction\nomp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_nonzero_coefs)\nomp.fit(X, y)\ncoef = omp.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 2)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noise-free measurements\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\n# plot the noisy reconstruction\nomp.fit(X, y_noisy)\ncoef = omp.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 3)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noisy measurements\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\n# plot the noisy reconstruction with number of non-zeros set by CV\nomp_cv = OrthogonalMatchingPursuitCV()\nomp_cv.fit(X, y_noisy)\ncoef = omp_cv.coef_\n(idx_r,) = coef.nonzero()\nplt.subplot(4, 1, 4)\nplt.xlim(0, 512)\nplt.title(\"Recovered signal from noisy measurements with CV\")\nplt.stem(idx_r, coef[idx_r], use_line_collection=True)\n\nplt.subplots_adjust(0.06, 0.04, 0.94, 0.90, 0.20, 0.38)\nplt.suptitle(\"Sparse signal recovery with Orthogonal Matching Pursuit\", fontsize=16)\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/scikit-learn-docs.zip

-3.39 KB
Binary file not shown.
27 Bytes

0 commit comments

Comments
 (0)