November 2017
Intermediate to advanced
1035 pages
11h 31m
English
In this recipe, we'll show how a decomposition method can actually be used for classification. DictionaryLearning attempts to take a dataset and transform it into a sparse representation.
With DictionaryLearning, the idea is that the features are a basis for the resulting datasets. In an effort to keep this recipe short, I'll assume you have idis_data and iris_target ready to go.
First, import DictionaryLearning:
>>> from sklearn.decomposition import DictionaryLearning
Next, use three components to represent the three species of iris:
>>> dl = DictionaryLearning(3)
Then transform every other data point so that we can test the classifier on the resulting data points after ...
Read now
Unlock full access