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.