SPICovariance#

class skarf.covariance.SPICovariance(spi: str | SPI)#

Covariance estimator wrapper around a PySPI SPI estimator.

Parameters:
spistr or SPI object

Name of SPI or SPI object with multivariate method.

Attributes:
covariance_ndarray of shape (n_features, n_features)

Estimated covariance matrix

n_features_in_int

Number of features seen during fit.

feature_names_in_array of shape (n_features_in_,)

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

Notes

Some of the SPI estimators in PySPI are themselves wrappers around sklearn covariance estimators. In those cases, this double wrapping is redundant. We include this wrapper however to have a familiar uniform API for all SPIs.

Methods

fit(X[, y])

Fit the underlying PySPI SPI estimator

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

covariance_: ndarray#

Estimated “covariance” matrix, shape (n_features, n_features)

feature_names_in_: ndarray#

Names of features seen during fit. Defined only when X has feature names.

fit(X: ndarray, y: None = None) Self#

Fit the underlying PySPI SPI estimator

Parameters:
Xarray-like of shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

yIgnored

Not used, present for API consistency by convention.

Returns:
selfobject

Returns the instance itself.

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.

n_features_in_: int#

Number of features seen during fit.

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.