skfolio.descriptor.BaseDescriptor#
- class skfolio.descriptor.BaseDescriptor[source]#
Base class for all descriptor transformers.
A descriptor takes an
AssetPaneland 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 asFixedWeightedFactor.Descriptors follow the
BaseAssetPanelTransformerprotocol:Batch-only descriptors implement only
fit_transform.Stateless descriptors declare
stateless=Trueand implement onlyfit_transform. The base class addspartial_fit_transformby delegating tofit_transform.Online descriptors implement both
fit_transformandpartial_fit_transform.fit_transformstarts from a clean state;partial_fit_transformcontinues 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 of this object.
get_params([deep])Get parameters for this estimator.
set_params(**params)Set the parameters of this estimator.
See also
BaseAssetPanelTransformerShared transformer contract.
BaseFactorExposureCombines 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
MetadataRequestencapsulating 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.