- Machine Learning Algorithms
- Giuseppe Bonaccorso
- 238字
- 2021-07-02 18:53:31
Atom extraction and dictionary learning
Dictionary learning is a technique which allows rebuilding a sample starting from a sparse dictionary of atoms (similar to principal components). In Mairal J., Bach F., Ponce J., Sapiro G., Online Dictionary Learning for Sparse Coding, Proceedings of the 29th International Conference on Machine Learning, 2009 there's a description of the same online strategy adopted by scikit-learn, which can be summarized as a double optimization problem where:

Is an input dataset and the target is to find both a dictionary D and a set of weights for each sample:

After the training process, an input vector can be computed as:

The optimization problem (which involves both D and alpha vectors) can be expressed as the minimization of the following loss function:

Here the parameter c controls the level of sparsity (which is proportional to the strength of L1 normalization). This problem can be solved by alternating the least square variable until a stable point is reached.
In scikit-learn, we can implement such an algorithm with the class DictionaryLearning (using the usual MNIST datasets), where n_components, as usual, determines the number of atoms:
from sklearn.decomposition import DictionaryLearning
>>> dl = DictionaryLearning(n_components=36, fit_algorithm='lars', transform_algorithm='lasso_lars')
>>> X_dict = dl.fit_transform(digits.data)
A plot of each atom (component) is shown in the following figure:

- Learning Python Web Penetration Testing
- 深入理解Android(卷I)
- Java高并發核心編程(卷2):多線程、鎖、JMM、JUC、高并發設計模式
- Java Web基礎與實例教程(第2版·微課版)
- Learning RabbitMQ
- Network Automation Cookbook
- HTML5 Mobile Development Cookbook
- Production Ready OpenStack:Recipes for Successful Environments
- C語言程序設計
- Java軟件開發基礎
- PhoneGap Mobile Application Development Cookbook
- jQuery開發基礎教程
- Webpack實戰:入門、進階與調優
- 西門子S7-200 SMART PLC編程從入門到實踐
- Test-Driven Machine Learning