class sklearn.decomposition.SparseCoder(dictionary, transform_algorithm=’omp’, transform_n_nonzero_coefs=None, transform_alpha=None, split_sign=False, n_jobs=None, positive_code=False) [source]
Sparse coding
Finds a sparse representation of data against a fixed, precomputed dictionary.
Each row of the result is the solution to a sparse coding problem. The goal is to find a sparse array code such that:
X ~= code * dictionary
Read more in the User Guide.
| Parameters: |
|
|---|---|
| Attributes: |
|
See also
DictionaryLearning, MiniBatchDictionaryLearning, SparsePCA, MiniBatchSparsePCA, sparse_encode
fit(X[, y]) | Do nothing and return the estimator unchanged |
fit_transform(X[, y]) | Fit to data, then transform it. |
get_params([deep]) | Get parameters for this estimator. |
set_params(**params) | Set the parameters of this estimator. |
transform(X) | Encode the data as a sparse combination of the dictionary atoms. |
__init__(dictionary, transform_algorithm=’omp’, transform_n_nonzero_coefs=None, transform_alpha=None, split_sign=False, n_jobs=None, positive_code=False) [source]
fit(X, y=None) [source]
Do nothing and return the estimator unchanged
This method is just there to implement the usual API and hence work in pipelines.
| Parameters: |
|
|---|---|
| Returns: |
|
fit_transform(X, y=None, **fit_params) [source]
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
| Parameters: |
|
|---|---|
| Returns: |
|
get_params(deep=True) [source]
Get parameters for this estimator.
| Parameters: |
|
|---|---|
| Returns: |
|
set_params(**params) [source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
| Returns: |
|
|---|
transform(X) [source]
Encode the data as a sparse combination of the dictionary atoms.
Coding method is determined by the object parameter transform_algorithm.
| Parameters: |
|
|---|---|
| Returns: |
|
sklearn.decomposition.SparseCoder
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.SparseCoder.html