skfolio.factor_exposure.GlobalFactor#
- class skfolio.factor_exposure.GlobalFactor(*, family='market')[source]#
Constant factor exposure equal to one for every asset.
GlobalFactorrepresents a cross-sectional regression intercept or broad market factor in a characteristics factor model. It does not depend on any characteristic field. It uses the panel dimensions to return an exposure matrix of ones with shape(n_observations, n_assets).For each observation \(t\) and asset \(i\), the exposure is:
\[x_{t,i} = 1\]This factor is typically used when the cross-sectional regression should estimate a common return component in addition to characteristic-based style industry or country factors.
- Parameters:
- familystr, default=”market”
The factor family this exposure belongs to. Factor families group related factors for basket-neutral constraints, neutralization, attribution and reporting. The default is
"market".
- Attributes:
- n_assets_int
Number of assets seen during fitting.
- asset_names_ndarray of shape (n_assets,)
Asset names seen during fitting.
Methods
fit_transform(X[, y])Return a constant exposure matrix.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
partial_fit_transform(X[, y])Stateless class delegation to
fit_transform.set_params(**params)Set the parameters of this estimator.
Examples
>>> from skfolio.factor_exposure import GlobalFactor >>> from skfolio.prior import CharacteristicsFactorModel >>> >>> model = CharacteristicsFactorModel( ... factors=[("market", GlobalFactor())] ... )
- fit_transform(X, y=None, **fit_params)[source]#
Return a constant exposure matrix.
- Parameters:
- XAssetPanel
Input panel used to determine the number of observations and assets.
- yNone
Ignored. Present for compatibility with scikit-learn’s API.
- **fit_paramsdict
Additional fit parameters. They are ignored.
- Returns:
- exposurendarray of shape (n_observations, n_assets)
Constant factor exposure equal to one for every asset in every observation.
- 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.
- partial_fit_transform(X, y=None, **fit_params)#
Stateless class delegation to
fit_transform.
- 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.