skfolio.descriptor.BaseDescriptor#

class skfolio.descriptor.BaseDescriptor[source]#

Base class for all descriptor transformers.

A descriptor takes an AssetPanel and returns one raw descriptor value per observation and asset, usually with shape (n_observations, n_assets). Descriptors are the inputs used by factor exposure estimators such as FixedWeightedFactor.

Descriptors follow the BaseAssetPanelTransformer protocol:

  • Batch-only descriptors implement only fit_transform.

  • Stateless descriptors declare stateless=True and implement only fit_transform. The base class adds partial_fit_transform by delegating to fit_transform.

  • Online descriptors implement both fit_transform and partial_fit_transform. fit_transform starts from a clean state; partial_fit_transform continues from the current state.

Examples include direct field access (Passthrough), point-in-time ratios (BookToPrice), and history-dependent descriptors (EWMomentum).

Methods

fit_transform(X[, y])

Fit the transformer if needed and return transformed values.

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.

See also

BaseAssetPanelTransformer

Shared transformer contract.

BaseFactorExposure

Combines descriptors into factor exposures.

abstractmethod fit_transform(X, y=None, **fit_params)#

Fit the transformer if needed and return transformed values.

Parameters:
XAssetPanel

Input panel data.

yNone

Ignored. Present for API consistency.

**fit_paramsdict

Additional fit parameters. Metadata routing may pass these parameters to sub-estimators when applicable.

Returns:
valuesndarray of shape (n_observations, n_assets) or (n_observations, n_assets, n_components)

Transformed values.

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.