Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

Understanding scikit learn import variants

$
0
0

Scikit learn import statements in their tutorials are on the form

from sklearn.decomposition import PCA

Another versions that works is

import sklearn.decompositionpca = sklearn.decomposition.PCA(n_components = 2)

However

import sklearnpca = sklearn.decomposition.PCA(n_components = 2)

does not, and complains

AttributeError: module 'sklearn' has no attribute 'decomposition'

Why is this, and how can I predict which ones will work and not so i don't have to test around? If the understanding and predictiveness extends to python packages in general that would be the best.


Viewing all articles
Browse latest Browse all 11661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>