DocumentationClassesMiniBatchDictionaryLearning

Class: MiniBatchDictionaryLearning

Mini-batch dictionary learning.

Finds a dictionary (a set of atoms) that performs well at sparsely encoding the fitted data.

Solves the optimization problem:

Python Reference

Constructors

new MiniBatchDictionaryLearning()

new MiniBatchDictionaryLearning(opts?): MiniBatchDictionaryLearning

Parameters

ParameterTypeDescription
opts?object-
opts.alpha?numberSparsity controlling parameter.
opts.batch_size?numberNumber of samples in each mini-batch.
opts.callback?anyA 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:
opts.max_iter?numberMaximum number of iterations over the complete dataset before stopping independently of any early stopping criterion heuristics.
opts.max_no_improvement?numberControl early stopping based on the consecutive number of mini batches that does not yield an improvement on the smoothed cost function. To disable convergence detection based on cost function, set max_no_improvement to undefined.
opts.n_components?numberNumber of dictionary elements to extract.
opts.n_jobs?numberNumber 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?booleanWhether to enforce positivity when finding the code.
opts.positive_dict?booleanWhether to enforce positivity when finding the dictionary.
opts.random_state?numberUsed 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?booleanWhether to shuffle the samples before forming batches.
opts.split_sign?booleanWhether 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.
opts.tol?numberControl early stopping based on the norm of the differences in the dictionary between 2 steps. To disable early stopping based on changes in the dictionary, set tol to 0.0.
opts.transform_algorithm?"threshold" | "lars" | "lasso_lars" | "lasso_cd" | "omp"Algorithm used to transform the data:
opts.transform_alpha?numberIf 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?numberMaximum number of iterations to perform if algorithm='lasso_cd' or 'lasso_lars'.
opts.transform_n_nonzero_coefs?numberNumber 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 | booleanTo control the verbosity of the procedure.

Returns MiniBatchDictionaryLearning

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/decomposition/MiniBatchDictionaryLearning.ts:23
_isInitializedbooleanfalsegenerated/decomposition/MiniBatchDictionaryLearning.ts:22
_pyPythonBridgeundefinedgenerated/decomposition/MiniBatchDictionaryLearning.ts:21
idstringundefinedgenerated/decomposition/MiniBatchDictionaryLearning.ts:18
optsanyundefinedgenerated/decomposition/MiniBatchDictionaryLearning.ts:19

Accessors

components_

Get Signature

get components_(): Promise<ArrayLike[]>

Components extracted from the data.

Returns Promise<ArrayLike[]>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:520


feature_names_in_

Get Signature

get feature_names_in_(): Promise<ArrayLike>

Names of features seen during fit. Defined only when X has feature names that are all strings.

Returns Promise<ArrayLike>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:574


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:547


n_iter_

Get Signature

get n_iter_(): Promise<number>

Number of iterations over the full dataset.

Returns Promise<number>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:601


n_steps_

Get Signature

get n_steps_(): Promise<number>

Number of mini-batches processed.

Returns Promise<number>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:628


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:165

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:221


fit()

fit(opts): Promise<any>

Fit the model from data in X.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Training vector, where n_samples is the number of samples and n_features is the number of features.
opts.y?anyNot used, present for API consistency by convention.

Returns Promise<any>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:238


fit_transform()

fit_transform(opts): Promise<any[]>

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

ParameterTypeDescription
optsobject-
opts.fit_params?anyAdditional fit parameters.
opts.X?ArrayLike[]Input samples.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns Promise<any[]>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:281


get_feature_names_out()

get_feature_names_out(opts): Promise<any>

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"\].

Parameters

ParameterTypeDescription
optsobject-
opts.input_features?anyOnly used to validate feature names with the names seen in fit.

Returns Promise<any>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:329


get_metadata_routing()

get_metadata_routing(opts): Promise<any>

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Parameters

ParameterTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns Promise<any>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:367


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:178


partial_fit()

partial_fit(opts): Promise<any>

Update the model using the data in X as a mini-batch.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Training vector, where n_samples is the number of samples and n_features is the number of features.
opts.y?anyNot used, present for API consistency by convention.

Returns Promise<any>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:403


set_output()

set_output(opts): Promise<any>

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters

ParameterTypeDescription
optsobject-
opts.transform?"default" | "pandas" | "polars"Configure output of transform and fit_transform.

Returns Promise<any>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:446


transform()

transform(opts): Promise<ArrayLike[]>

Encode the data as a sparse combination of the dictionary atoms.

Coding method is determined by the object parameter transform_algorithm.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Test data to be transformed, must have the same number of features as the data used to train the model.

Returns Promise<ArrayLike[]>

Defined in generated/decomposition/MiniBatchDictionaryLearning.ts:484