Mini-batch dictionary learning.
Finds a dictionary (a set of atoms) that performs well at sparsely encoding the fitted data.
Solves the optimization problem:
new MiniBatchDictionaryLearning(opts?: object): MiniBatchDictionaryLearning;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.alpha? |
number |
Sparsity controlling parameter. Default Value 1 |
opts.batch_size? |
number |
Number of samples in each mini-batch. Default Value 256 |
opts.callback? |
any |
A callable that gets invoked at the end of each iteration. |
opts.dict_init? |
ArrayLike [] |
Initial value of the dictionary for warm restart scenarios. |
opts.fit_algorithm? |
"cd" | "lars" |
The algorithm used: Default Value 'lars' |
opts.max_iter? |
number |
Maximum number of iterations over the complete dataset before stopping independently of any early stopping criterion heuristics. If max\_iter is not undefined , n\_iter is ignored. |
opts.max_no_improvement? |
number |
Control early stopping based on the consecutive number of mini batches that does not yield an improvement on the smoothed cost function. Used only if max\_iter is not undefined . To disable convergence detection based on cost function, set max\_no\_improvement to undefined . Default Value 10 |
opts.n_components? |
number |
Number of dictionary elements to extract. |
opts.n_iter? |
number |
Total number of iterations over data batches to perform. Default Value 1000 |
opts.n_jobs? |
number |
Number of parallel jobs to run. undefined means 1 unless in a joblib.parallel\_backend context. \-1 means using all processors. See Glossary for more details. |
opts.positive_code? |
boolean |
Whether to enforce positivity when finding the code. Default Value false |
opts.positive_dict? |
boolean |
Whether to enforce positivity when finding the dictionary. Default Value false |
opts.random_state? |
number |
Used for initializing the dictionary when dict\_init is not specified, randomly shuffling the data when shuffle is set to true , and updating the dictionary. Pass an int for reproducible results across multiple function calls. See Glossary. |
opts.shuffle? |
boolean |
Whether to shuffle the samples before forming batches. Default Value true |
opts.split_sign? |
boolean |
Whether to split the sparse feature vector into the concatenation of its negative part and its positive part. This can improve the performance of downstream classifiers. Default Value false |
opts.tol? |
number |
Control early stopping based on the norm of the differences in the dictionary between 2 steps. Used only if max\_iter is not undefined . To disable early stopping based on changes in the dictionary, set tol to 0.0. Default Value 0.001 |
opts.transform_algorithm? |
"threshold" | "lars" | "lasso_lars" | "lasso_cd" | "omp" |
Algorithm used to transform the data: Default Value 'omp' |
opts.transform_alpha? |
number |
If algorithm='lasso\_lars' or algorithm='lasso\_cd' , alpha is the penalty applied to the L1 norm. If algorithm='threshold' , alpha is the absolute value of the threshold below which coefficients will be squashed to zero. If undefined , defaults to alpha . |
opts.transform_max_iter? |
number |
Maximum number of iterations to perform if algorithm='lasso\_cd' or 'lasso\_lars' . Default Value 1000 |
opts.transform_n_nonzero_coefs? |
number |
Number of nonzero coefficients to target in each column of the solution. This is only used by algorithm='lars' and algorithm='omp' . If undefined , then transform\_n\_nonzero\_coefs=int(n\_features / 10) . |
opts.verbose? |
number | boolean |
To control the verbosity of the procedure. Default Value false |
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:25
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:255
Fit the model from data in X.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Training vector, where n\_samples is the number of samples and n\_features is the number of features. |
opts.y? |
any |
Not used, present for API consistency by convention. |
Promise
<any
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:272
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit\_params
and returns a transformed version of X
.
fit_transform(opts: object): Promise<any[]>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Input samples. |
opts.fit_params? |
any |
Additional fit parameters. |
opts.y? |
ArrayLike |
Target values (undefined for unsupervised transformations). |
Promise
<any
[]>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:316
Get output feature names for transformation.
The feature names out will prefixed by the lowercased class name. For example, if the transformer outputs 3 features, then the feature names out are: \["class\_name0", "class\_name1", "class\_name2"\]
.
get_feature_names_out(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.input_features? |
any |
Only used to validate feature names with the names seen in fit . |
Promise
<any
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:370
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:410
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:183
Update the model using the data in X as a mini-batch.
partial_fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Training vector, where n\_samples is the number of samples and n\_features is the number of features. |
opts.y? |
any |
Not used, present for API consistency by convention. |
Promise
<any
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:448
Set output container.
See Introducing the set_output API for an example on how to use the API.
set_output(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.transform? |
"default" | "pandas" |
Configure output of transform and fit\_transform . |
Promise
<any
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:493
Encode the data as a sparse combination of the dictionary atoms.
Coding method is determined by the object parameter transform\_algorithm
.
transform(opts: object): Promise<ArrayLike[]>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Test data to be transformed, must have the same number of features as the data used to train the model. |
Promise
<ArrayLike
[]>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:533
boolean
=false
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:23
boolean
=false
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:22
PythonBridge
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:21
string
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:18
any
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:19
Components extracted from the data.
components_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:571
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:625
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:598
Number of iterations over the full dataset.
n_iter_(): Promise<number>;
Promise
<number
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:652
Number of mini-batches processed.
n_steps_(): Promise<number>;
Promise
<number
>
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:679
py(): PythonBridge;
PythonBridge
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:170
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/decomposition/MiniBatchDictionaryLearning.ts:174