Thanks to visit codestin.com
Credit goes to github.com

Skip to content

division by zero in PCA.score_samples #8544

Closed
@amueller

Description

@amueller
from sklearn.datasets import fetch_lfw_people
from sklearn.decomposition import PCA

people = fetch_lfw_people(min_faces_per_person=20, resize=0.7)

pca = PCA(n_components=100).fit(people.data)
pca.score_samples(people.data)

yields

/home/andy/checkout/scikit-learn/sklearn/decomposition/base.py:75: RuntimeWarning: divide by zero encountered in true_divide precision.flat[::len(precision) + 1] += 1. / exp_var_diff

and then a

ValueError: array must not contain infs or NaNs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions