1

I'm trying to do PCA with pretty simple dataset, but I'm still getting this error: AttributeError: 'PCA' object has no attribute 'singular_values_'

Here is code:

import numpy as np from sklearn.decomposition import PCA X = np.array([[0.92, 0.51], [0.72, 0.59], [0.83, 1.03], [0.81, 1.21], [0.82, 0.63], [0.93, 0.68], [0.84, 0.57], [0.89, 1.52], [0.89, 1.04], [0.95, 0.99]]) pca = PCA(n_components=2) pca.fit_transform(X) print(pca.mean_) print(pca.components_) print(pca.explained_variance_) print(pca.explained_variance_ratio_) print(pca.singular_values_) print(pca.n_components_) print(pca.noise_variance_) 

I get everything except for singular_values_

Thank you for your help!

1 Answer 1

2

The singular_values_ attribute was added in sklearn 0.19, released in Aug-2017. That you cannot access it indicates you are using an older version.

Sign up to request clarification or add additional context in comments.

1 Comment

In my case, I have the same error, but checking the version like "sklearn.__version__" is correct '0.19.1'. What can be?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.