archetypes.BiAA#
- class archetypes.BiAA(n_archetypes=(3, 2), n_init=5, max_iter=300, tol=0.0001, algorithm_init='auto', verbose=False, random_state=None)#
Bi-Archetype Analysis estimator.
- Parameters:
- n_archetypestuple of int, default=(3, 2)
The number of archetypes, both for samples and for features, to compute.
- n_initint, default=5
Number of time the archetype analysis algorithm will be run with different coefficient initialization. The final results will be the best output of n_init consecutive runs in terms of RSS.
- max_iterint, default=300
Maximum number of iterations of the archetype analysis algorithm for a single run.
- tolfloat, default=1e-4
Relative tolerance of two consecutive iterations to declare convergence.
- verbosebool, default=False
Verbosity mode.
- random_stateint, RandomState instance or None, default=None
Determines random number generation of coefficients. Use an int to make the randomness deterministic.
Methods
fit
(X[, y])Compute Bi-Archetype Analysis.
fit_transform
(X[, y])Compute the biarchetypes and transform X to archetype-distance space.
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
set_params
(**params)Set the parameters of this estimator.
transform
(X)Transform X to a biarchetype-distance space.
- fit(X, y=None, **fit_params)#
Compute Bi-Archetype Analysis.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to compute the archetypes. It must be noted that the data will be converted to C ordering, which will cause a memory copy if the given data is not C-contiguous. If a sparse matrix is passed, a copy will be made if it’s not in CSR format.
- yIgnored
Not used, present here for API consistency by convention.
- Returns:
- selfobject
Fitted estimator.
- fit_transform(X, y=None, **fit_params)#
Compute the biarchetypes and transform X to archetype-distance space.
Equivalent to fit(X).transform(X), but more efficiently implemented.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
New data to transform.
- yIgnored
Not used, present here for API consistency by convention.
- Returns:
- X_new_samplesndarray of shape (n_samples, n_samp_archetypes)
X samples transformed in the new space.
- X_new_featuresndarray of shape (n_feat_archetypes, n_features)
X features transformed in the new space.
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequest
encapsulating routing information.
- get_params(deep=True)#
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.
- transform(X)#
Transform X to a biarchetype-distance space.
In the new space, each dimension is the distance to the archetypes. Note that even if X is sparse, the array returned by transform will typically be dense.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
New data to transform.
- Returns:
- X_new_samplesndarray of shape (n_samples, n_samp_archetypes)
X samples transformed in the new space.
- X_new_featuresndarray of shape (n_feat_archetypes, n_features)
X features transformed in the new space.