8000 [MRG] Fixes issue #6746 "number of power iterations" message by chriskaschner · Pull Request #7010 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] Fixes issue #6746 "number of power iterations" message #7010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/modules/pipeline.rst
10000
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ is an estimator object::
>>> estimators = [('reduce_dim', PCA()), ('svm', SVC())]
>>> clf = Pipeline(estimators)
>>> clf # doctest: +NORMALIZE_WHITESPACE
Pipeline(steps=[('reduce_dim', PCA(copy=True, iterated_power=4,
Pipeline(steps=[('reduce_dim', PCA(copy=True, iterated_power=None,
n_components=None, random_state=None, svd_solver='auto', tol=0.0,
whiten=False)), ('svm', SVC(C=1.0, cache_size=200, class_weight=None,
coef0=0.0, decision_function_shape=None, degree=3, gamma='auto',
Expand All @@ -65,20 +65,20 @@ filling in the names automatically::
The estimators of a pipeline are stored as a list in the ``steps`` attribute::

>>> clf.steps[0]
('reduce_dim', PCA(copy=True, iterated_power=4, n_components=None, random_state=None,
('reduce_dim', PCA(copy=True, iterated_power=None, n_components=None, random_state=None,
svd_solver='auto', tol=0.0, whiten=False))

and as a ``dict`` in ``named_steps``::

>>> clf.named_steps['reduce_dim']
PCA(copy=True, iterated_power=4, n_components=None, random_state=None,
PCA(copy=True, iterated_power=None, n_components=None, random_state=None,
svd_solver='auto', tol=0.0, whiten=False)

Parameters of the estimators in the pipeline can be accessed using the
``<estimator>__<parameter>`` syntax::

>>> clf.set_params(svm__C=10) # doctest: +NORMALIZE_WHITESPACE
Pipeline(steps=[('reduce_dim', PCA(copy=True, iterated_power=4,
Pipeline(steps=[('reduce_dim', PCA(copy=True, iterated_power=None,
n_components=None, random_state=None, svd_solver='auto', tol=0.0,
whiten=False)), ('svm', SVC(C=10, cache_size=200, class_weight=None,
coef0=0.0, decision_function_shape=None, degree=3, gamma='auto',
Expand Down Expand Up @@ -159,7 +159,7 @@ and ``value`` is an estimator object::
>>> combined = FeatureUnion(estimators)
>>> combined # doctest: +NORMALIZE_WHITESPACE
FeatureUnion(n_jobs=1, transformer_list=[('linear_pca', PCA(copy=True,
iterated_power=4, n_components=None, random_state=None,
iterated_power=None, n_components=None, random_state=None,
svd_solver='auto', tol=0.0, whiten=False)), ('kernel_pca',
KernelPCA(alpha=1.0, coef0=1, copy_X=True, degree=3,
eigen_solver='auto', fit_inverse_transform=False, gamma=None,
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial/statistical_inference/unsupervised_learning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ algorithms. The simplest clustering algorithm is

Clustering in general and KMeans, in particular, can be seen as a way
of choosing a small number of exemplars to compress the information.
The problem is sometimes known as
The problem is sometimes known as
`vector quantization <https://en.wikipedia.org/wiki/Vector_quantization>`_.
For instance, this can be used to posterize an image::

Expand Down Expand Up @@ -275,7 +275,7 @@ data by projecting on a principal subspace.
>>> from sklearn import decomposition
>>> pca = decomposition.PCA()
>>> pca.fit(X)
PCA(copy=True, iterated_power=4, n_components=None, random_state=None,
PCA(copy=True, iterated_power=None, n_components=None, random_state=None,
svd_solver='auto', tol=0.0, whiten=False)
>>> print(pca.explained_variance_) # doctest: +SKIP
[ 2.18565811e+00 1.19346747e+00 8.43026679e-32]
Expand Down
14 changes: 7 additions & 7 deletions sklearn/decomposition/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,21 @@ class PCA(_BasePCA):
>>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
>>> pca = PCA(n_components=2)
>>> pca.fit(X)
PCA(copy=True, iterated_power=4, n_components=2, random_state=None,
PCA(copy=True, iterated_power=None, n_components=2, random_state=None,
svd_solver='auto', tol=0.0, whiten=False)
>>> print(pca.explained_variance_ratio_) # doctest: +ELLIPSIS
[ 0.99244... 0.00755...]

>>> pca = PCA(n_components=2, svd_solver='full')
>>> pca.fit(X) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
PCA(copy=True, iterated_power=4, n_components=2, random_state=None,
PCA(copy=True, iterated_power=None, n_components=2, random_state=None,
svd_solver='full', tol=0.0, whiten=False)
>>> print(pca.explained_variance_ratio_) # doctest: +ELLIPSIS
[ 0.99244... 0.00755...]

>>> pca = PCA(n_components=1, svd_solver='arpack')
>>> pca.fit(X)
PCA(copy=True, iterated_power=4, n_components=1, random_state=None,
PCA(copy=True, iterated_power=None, n_components=1, random_state=None,
svd_solver='arpack', tol=0.0, whiten=False)
>>> print(pca.explained_variance_ratio_) # doctest: +ELLIPSIS
[ 0.99244...]
Expand All @@ -268,7 +268,7 @@ class PCA(_BasePCA):
"""

def __init__(self, n_components=None, copy=True, whiten=False,
svd_solver='auto', tol=0.0, iterated_power=4,
svd_solver='auto', tol=0.0, iterated_power=None,
random_state=None):
self.n_components = n_components
self.copy = copy
Expand Down Expand Up @@ -541,9 +541,9 @@ class RandomizedPCA(BaseEstimator, TransformerMixin):
.. versionchanged:: 0.18

whiten : bool, optional
When True (False by default) the `components_` vectors are multiplied by
the square root of (n_samples) and divided by the singular values to
ensure uncorrelated outputs with unit component-wise variances.
When True (False by default) the `components_` vectors are multiplied
by the square root of (n_samples) and divided by the singular values
to ensure uncorrelated outputs with unit component-wise variances.

Whitening will remove some information from the transformed signal
(the relative variance scales of the components) but can sometime
Expand Down
2 changes: 1 addition & 1 deletion sklearn/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def make_union(*transformers):
>>> make_union(PCA(), TruncatedSVD()) # doctest: +NORMALIZE_WHITESPACE
FeatureUnion(n_jobs=1,
transformer_list=[('pca',
PCA(copy=True, iterated_power=4,
PCA(copy=True, iterated_power=None,
n_components=None, random_state=None,
svd_solver='auto', tol=0.0, whiten=False)),
('truncatedsvd',
Expand Down
0