Skip to content

Commit c00f69f

Browse files
committed
Pushing the docs for revision for branch: master, commit 28bcb43dd2eacfaa98f0215ec8481e0da9f8ec5d
1 parent e9be350 commit c00f69f

File tree

905 files changed

+2671
-2647
lines changed

Some content is hidden

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

905 files changed

+2671
-2647
lines changed
473 Bytes
Binary file not shown.
464 Bytes
Binary file not shown.

dev/_downloads/face_recognition.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"execution_count": null,
2525
"cell_type": "code",
2626
"source": [
27-
"from __future__ import print_function\n\nfrom time import time\nimport logging\nimport matplotlib.pyplot as plt\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.datasets import fetch_lfw_people\nfrom sklearn.metrics import classification_report\nfrom sklearn.metrics import confusion_matrix\nfrom sklearn.decomposition import RandomizedPCA\nfrom sklearn.svm import SVC\n\n\nprint(__doc__)\n\n# Display progress logs on stdout\nlogging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')"
27+
"from __future__ import print_function\n\nfrom time import time\nimport logging\nimport matplotlib.pyplot as plt\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.datasets import fetch_lfw_people\nfrom sklearn.metrics import classification_report\nfrom sklearn.metrics import confusion_matrix\nfrom sklearn.decomposition import PCA\nfrom sklearn.svm import SVC\n\n\nprint(__doc__)\n\n# Display progress logs on stdout\nlogging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')"
2828
],
2929
"outputs": [],
3030
"metadata": {
@@ -78,7 +78,7 @@
7878
"execution_count": null,
7979
"cell_type": "code",
8080
"source": [
81-
"n_components = 150\n\nprint(\"Extracting the top %d eigenfaces from %d faces\"\n % (n_components, X_train.shape[0]))\nt0 = time()\npca = RandomizedPCA(n_components=n_components, whiten=True).fit(X_train)\nprint(\"done in %0.3fs\" % (time() - t0))\n\neigenfaces = pca.components_.reshape((n_components, h, w))\n\nprint(\"Projecting the input data on the eigenfaces orthonormal basis\")\nt0 = time()\nX_train_pca = pca.transform(X_train)\nX_test_pca = pca.transform(X_test)\nprint(\"done in %0.3fs\" % (time() - t0))"
81+
"n_components = 150\n\nprint(\"Extracting the top %d eigenfaces from %d faces\"\n % (n_components, X_train.shape[0]))\nt0 = time()\npca = PCA(n_components=n_components, svd_solver='randomized',\n whiten=True).fit(X_train)\nprint(\"done in %0.3fs\" % (time() - t0))\n\neigenfaces = pca.components_.reshape((n_components, h, w))\n\nprint(\"Projecting the input data on the eigenfaces orthonormal basis\")\nt0 = time()\nX_train_pca = pca.transform(X_train)\nX_test_pca = pca.transform(X_test)\nprint(\"done in %0.3fs\" % (time() - t0))"
8282
],
8383
"outputs": [],
8484
"metadata": {

dev/_downloads/face_recognition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from sklearn.datasets import fetch_lfw_people
3939
from sklearn.metrics import classification_report
4040
from sklearn.metrics import confusion_matrix
41-
from sklearn.decomposition import RandomizedPCA
41+
from sklearn.decomposition import PCA
4242
from sklearn.svm import SVC
4343

4444

@@ -88,7 +88,8 @@
8888
print("Extracting the top %d eigenfaces from %d faces"
8989
% (n_components, X_train.shape[0]))
9090
t0 = time()
91-
pca = RandomizedPCA(n_components=n_components, whiten=True).fit(X_train)
91+
pca = PCA(n_components=n_components, svd_solver='randomized',
92+
whiten=True).fit(X_train)
9293
print("done in %0.3fs" % (time() - t0))
9394

9495
eigenfaces = pca.components_.reshape((n_components, h, w))

dev/_downloads/plot_faces_decomposition.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"execution_count": null,
7272
"cell_type": "code",
7373
"source": [
74-
"estimators = [\n ('Eigenfaces - RandomizedPCA',\n decomposition.RandomizedPCA(n_components=n_components, whiten=True),\n True),\n\n ('Non-negative components - NMF',\n decomposition.NMF(n_components=n_components, init='nndsvda', tol=5e-3),\n False),\n\n ('Independent components - FastICA',\n decomposition.FastICA(n_components=n_components, whiten=True),\n True),\n\n ('Sparse comp. - MiniBatchSparsePCA',\n decomposition.MiniBatchSparsePCA(n_components=n_components, alpha=0.8,\n n_iter=100, batch_size=3,\n random_state=rng),\n True),\n\n ('MiniBatchDictionaryLearning',\n decomposition.MiniBatchDictionaryLearning(n_components=15, alpha=0.1,\n n_iter=50, batch_size=3,\n random_state=rng),\n True),\n\n ('Cluster centers - MiniBatchKMeans',\n MiniBatchKMeans(n_clusters=n_components, tol=1e-3, batch_size=20,\n max_iter=50, random_state=rng),\n True),\n\n ('Factor Analysis components - FA',\n decomposition.FactorAnalysis(n_components=n_components, max_iter=2),\n True),\n]"
74+
"estimators = [\n ('Eigenfaces - PCA using randomized SVD',\n decomposition.PCA(n_components=n_components, svd_solver='randomized',\n whiten=True),\n True),\n\n ('Non-negative components - NMF',\n decomposition.NMF(n_components=n_components, init='nndsvda', tol=5e-3),\n False),\n\n ('Independent components - FastICA',\n decomposition.FastICA(n_components=n_components, whiten=True),\n True),\n\n ('Sparse comp. - MiniBatchSparsePCA',\n decomposition.MiniBatchSparsePCA(n_components=n_components, alpha=0.8,\n n_iter=100, batch_size=3,\n random_state=rng),\n True),\n\n ('MiniBatchDictionaryLearning',\n decomposition.MiniBatchDictionaryLearning(n_components=15, alpha=0.1,\n n_iter=50, batch_size=3,\n random_state=rng),\n True),\n\n ('Cluster centers - MiniBatchKMeans',\n MiniBatchKMeans(n_clusters=n_components, tol=1e-3, batch_size=20,\n max_iter=50, random_state=rng),\n True),\n\n ('Factor Analysis components - FA',\n decomposition.FactorAnalysis(n_components=n_components, max_iter=2),\n True),\n]"
7575
],
7676
"outputs": [],
7777
"metadata": {
@@ -107,7 +107,7 @@
107107
"execution_count": null,
108108
"cell_type": "code",
109109
"source": [
110-
"for name, estimator, center in estimators:\n print(\"Extracting the top %d %s...\" % (n_components, name))\n t0 = time()\n data = faces\n if center:\n data = faces_centered\n estimator.fit(data)\n train_time = (time() - t0)\n print(\"done in %0.3fs\" % train_time)\n if hasattr(estimator, 'cluster_centers_'):\n components_ = estimator.cluster_centers_\n else:\n components_ = estimator.components_\n if hasattr(estimator, 'noise_variance_'):\n plot_gallery(\"Pixelwise variance\",\n estimator.noise_variance_.reshape(1, -1), n_col=1,\n n_row=1)\n plot_gallery('%s - Train time %.1fs' % (name, train_time),\n components_[:n_components])\n\nplt.show()"
110+
"for name, estimator, center in estimators:\n print(\"Extracting the top %d %s...\" % (n_components, name))\n t0 = time()\n data = faces\n if center:\n data = faces_centered\n estimator.fit(data)\n train_time = (time() - t0)\n print(\"done in %0.3fs\" % train_time)\n if hasattr(estimator, 'cluster_centers_'):\n components_ = estimator.cluster_centers_\n else:\n components_ = estimator.components_\n\n # Plot an image representing the pixelwise variance provided by the\n # estimator e.g its noise_variance_ attribute. The Eigenfaces estimator,\n # via the PCA decomposition, also provides a scalar noise_variance_\n # (the mean of pixelwise variance) that cannot be displayed as an image\n # so we skip it.\n if (hasattr(estimator, 'noise_variance_') and\n estimator.noise_variance_.ndim > 0): # Skip the Eigenfaces case\n plot_gallery(\"Pixelwise variance\",\n estimator.noise_variance_.reshape(1, -1), n_col=1,\n n_row=1)\n plot_gallery('%s - Train time %.1fs' % (name, train_time),\n components_[:n_components])\n\nplt.show()"
111111
],
112112
"outputs": [],
113113
"metadata": {

dev/_downloads/plot_faces_decomposition.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ def plot_gallery(title, images, n_col=n_col, n_row=n_row):
6666
# List of the different estimators, whether to center and transpose the
6767
# problem, and whether the transformer uses the clustering API.
6868
estimators = [
69-
('Eigenfaces - RandomizedPCA',
70-
decomposition.RandomizedPCA(n_components=n_components, whiten=True),
69+
('Eigenfaces - PCA using randomized SVD',
70+
decomposition.PCA(n_components=n_components, svd_solver='randomized',
71+
whiten=True),
7172
True),
7273

7374
('Non-negative components - NMF',
@@ -122,7 +123,14 @@ def plot_gallery(title, images, n_col=n_col, n_row=n_row):
122123
components_ = estimator.cluster_centers_
123124
else:
124125
components_ = estimator.components_
125-
if hasattr(estimator, 'noise_variance_'):
126+
127+
# Plot an image representing the pixelwise variance provided by the
128+
# estimator e.g its noise_variance_ attribute. The Eigenfaces estimator,
129+
# via the PCA decomposition, also provides a scalar noise_variance_
130+
# (the mean of pixelwise variance) that cannot be displayed as an image
131+
# so we skip it.
132+
if (hasattr(estimator, 'noise_variance_') and
133+
estimator.noise_variance_.ndim > 0): # Skip the Eigenfaces case
126134
plot_gallery("Pixelwise variance",
127135
estimator.noise_variance_.reshape(1, -1), n_col=1,
128136
n_row=1)
-441 Bytes
90 Bytes
-49 Bytes
-178 Bytes
-178 Bytes
-169 Bytes
-169 Bytes
112 Bytes
112 Bytes
129 Bytes
-362 Bytes
-368 Bytes
-125 Bytes
-180 Bytes
-180 Bytes
-138 Bytes
-138 Bytes
-76 Bytes
-76 Bytes
-67 Bytes
-67 Bytes
-272 Bytes
-272 Bytes
-166 Bytes
-36 Bytes
282 Bytes
282 Bytes
707 Bytes
-80 Bytes
-121 Bytes
-22 Bytes
522 Bytes
522 Bytes
-190 Bytes
59 Bytes

dev/_sources/auto_examples/applications/face_recognition.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Gerhard Schroeder 0.76 0.76 0.76 25
4646
from sklearn.datasets import fetch_lfw_people
4747
from sklearn.metrics import classification_report
4848
from sklearn.metrics import confusion_matrix
49-
from sklearn.decomposition import RandomizedPCA
49+
from sklearn.decomposition import PCA
5050
from sklearn.svm import SVC
5151

5252

@@ -111,7 +111,8 @@ dataset): unsupervised feature extraction / dimensionality reduction
111111
print("Extracting the top %d eigenfaces from %d faces"
112112
% (n_components, X_train.shape[0]))
113113
t0 = time()
114-
pca = RandomizedPCA(n_components=n_components, whiten=True).fit(X_train)
114+
pca = PCA(n_components=n_components, svd_solver='randomized',
115+
whiten=True).fit(X_train)
115116
print("done in %0.3fs" % (time() - t0))
116117

117118
eigenfaces = pca.components_.reshape((n_components, h, w))

dev/_sources/auto_examples/applications/plot_model_complexity_influence.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,69 +226,69 @@ main code
226226
learning_rate='optimal', loss='modified_huber', n_iter=5, n_jobs=1,
227227
penalty='elasticnet', power_t=0.5, random_state=None, shuffle=True,
228228
verbose=0, warm_start=False)
229-
Complexity: 4454 | Hamming Loss (Misclassification Ratio): 0.2501 | Pred. Time: 0.026798s
229+
Complexity: 4454 | Hamming Loss (Misclassification Ratio): 0.2501 | Pred. Time: 0.027413s
230230

231231
Benchmarking SGDClassifier(alpha=0.001, average=False, class_weight=None, epsilon=0.1,
232232
eta0=0.0, fit_intercept=True, l1_ratio=0.5, learning_rate='optimal',
233233
loss='modified_huber', n_iter=5, n_jobs=1, penalty='elasticnet',
234234
power_t=0.5, random_state=None, shuffle=True, verbose=0,
235235
warm_start=False)
236-
Complexity: 1624 | Hamming Loss (Misclassification Ratio): 0.2923 | Pred. Time: 0.021841s
236+
Complexity: 1624 | Hamming Loss (Misclassification Ratio): 0.2923 | Pred. Time: 0.020356s
237237

238238
Benchmarking SGDClassifier(alpha=0.001, average=False, class_weight=None, epsilon=0.1,
239239
eta0=0.0, fit_intercept=True, l1_ratio=0.75,
240240
learning_rate='optimal', loss='modified_huber', n_iter=5, n_jobs=1,
241241
penalty='elasticnet', power_t=0.5, random_state=None, shuffle=True,
242242
verbose=0, warm_start=False)
243-
Complexity: 873 | Hamming Loss (Misclassification Ratio): 0.3191 | Pred. Time: 0.017555s
243+
Complexity: 873 | Hamming Loss (Misclassification Ratio): 0.3191 | Pred. Time: 0.016345s
244244

245245
Benchmarking SGDClassifier(alpha=0.001, average=False, class_weight=None, epsilon=0.1,
246246
eta0=0.0, fit_intercept=True, l1_ratio=0.9, learning_rate='optimal',
247247
loss='modified_huber', n_iter=5, n_jobs=1, penalty='elasticnet',
248248
power_t=0.5, random_state=None, shuffle=True, verbose=0,
249249
warm_start=False)
250-
Complexity: 655 | Hamming Loss (Misclassification Ratio): 0.3252 | Pred. Time: 0.014737s
250+
Complexity: 655 | Hamming Loss (Misclassification Ratio): 0.3252 | Pred. Time: 0.014995s
251251

252252
Benchmarking NuSVR(C=1000.0, cache_size=200, coef0=0.0, degree=3, gamma=3.0517578125e-05,
253253
kernel='rbf', max_iter=-1, nu=0.1, shrinking=True, tol=0.001,
254254
verbose=False)
255-
Complexity: 69 | MSE: 31.8133 | Pred. Time: 0.000369s
255+
Complexity: 69 | MSE: 31.8133 | Pred. Time: 0.000366s
256256

257257
Benchmarking NuSVR(C=1000.0, cache_size=200, coef0=0.0, degree=3, gamma=3.0517578125e-05,
258258
kernel='rbf', max_iter=-1, nu=0.25, shrinking=True, tol=0.001,
259259
verbose=False)
260-
Complexity: 136 | MSE: 25.6140 | Pred. Time: 0.000655s
260+
Complexity: 136 | MSE: 25.6140 | Pred. Time: 0.000648s
261261

262262
Benchmarking NuSVR(C=1000.0, cache_size=200, coef0=0.0, degree=3, gamma=3.0517578125e-05,
263263
kernel='rbf', max_iter=-1, nu=0.5, shrinking=True, tol=0.001,
264264
verbose=False)
265-
Complexity: 243 | MSE: 22.3315 | Pred. Time: 0.001119s
265+
Complexity: 243 | MSE: 22.3315 | Pred. Time: 0.001113s
266266

267267
Benchmarking NuSVR(C=1000.0, cache_size=200, coef0=0.0, degree=3, gamma=3.0517578125e-05,
268268
kernel='rbf', max_iter=-1, nu=0.75, shrinking=True, tol=0.001,
269269
verbose=False)
270-
Complexity: 350 | MSE: 21.3679 | Pred. Time: 0.001580s
270+
Complexity: 350 | MSE: 21.3679 | Pred. Time: 0.001572s
271271

272272
Benchmarking NuSVR(C=1000.0, cache_size=200, coef0=0.0, degree=3, gamma=3.0517578125e-05,
273273
kernel='rbf', max_iter=-1, nu=0.9, shrinking=True, tol=0.001,
274274
verbose=False)
275-
Complexity: 404 | MSE: 21.0915 | Pred. Time: 0.001831s
275+
Complexity: 404 | MSE: 21.0915 | Pred. Time: 0.001808s
276276

277277
Benchmarking GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,
278278
learning_rate=0.1, loss='ls', max_depth=3, max_features=None,
279279
max_leaf_nodes=None, min_impurity_split=1e-07,
280280
min_samples_leaf=1, min_samples_split=2,
281281
min_weight_fraction_leaf=0.0, n_estimators=10, presort='auto',
282282
random_state=None, subsample=1.0, verbose=0, warm_start=False)
283-
Complexity: 10 | MSE: 28.9793 | Pred. Time: 0.000119s
283+
Complexity: 10 | MSE: 28.9793 | Pred. Time: 0.000114s
284284

285285
Benchmarking GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,
286286
learning_rate=0.1, loss='ls', max_depth=3, max_features=None,
287287
max_leaf_nodes=None, min_impurity_split=1e-07,
288288
min_samples_leaf=1, min_samples_split=2,
289289
min_weight_fraction_leaf=0.0, n_estimators=50, presort='auto',
290290
random_state=None, subsample=1.0, verbose=0, warm_start=False)
291-
Complexity: 50 | MSE: 8.3398 | Pred. Time: 0.000197s
291+
Complexity: 50 | MSE: 8.3398 | Pred. Time: 0.000191s
292292

293293
Benchmarking GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,
294294
learning_rate=0.1, loss='ls', max_depth=3, max_features=None,
@@ -297,7 +297,7 @@ main code
297297
min_weight_fraction_leaf=0.0, n_estimators=100,
298298
presort='auto', random_state=None, subsample=1.0, verbose=0,
299299
warm_start=False)
300-
Complexity: 100 | MSE: 7.0096 | Pred. Time: 0.000277s
300+
Complexity: 100 | MSE: 7.0096 | Pred. Time: 0.000271s
301301

302302
Benchmarking GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,
303303
learning_rate=0.1, loss='ls', max_depth=3, max_features=None,
@@ -306,7 +306,7 @@ main code
306306
min_weight_fraction_leaf=0.0, n_estimators=200,
307307
presort='auto', random_state=None, subsample=1.0, verbose=0,
308308
warm_start=False)
309-
Complexity: 200 | MSE: 6.1836 | Pred. Time: 0.000430s
309+
Complexity: 200 | MSE: 6.1836 | Pred. Time: 0.000425s
310310

311311
Benchmarking GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,
312312
learning_rate=0.1, loss='ls', max_depth=3, max_features=None,
@@ -315,10 +315,10 @@ main code
315315
min_weight_fraction_leaf=0.0, n_estimators=500,
316316
presort='auto', random_state=None, subsample=1.0, verbose=0,
317317
warm_start=False)
318-
Complexity: 500 | MSE: 6.3426 | Pred. Time: 0.000936s
318+
Complexity: 500 | MSE: 6.3426 | Pred. Time: 0.000922s
319319

320320

321-
**Total running time of the script:** ( 0 minutes 25.085 seconds)
321+
**Total running time of the script:** ( 0 minutes 25.481 seconds)
322322

323323

324324

0 commit comments

Comments
 (0)