skfolio.alpha.FixedWeightedAlpha#

class skfolio.alpha.FixedWeightedAlpha(*, descriptors, forecast_scale, weights=None, forecast_unit=IDIO_RETURN, min_coverage=0.0, neutralize_against=None, outlier_transformer=None, scoring_transformer=None, transform_by_group=None, n_jobs=1)[source]#

Fixed-weighted descriptor alpha estimator.

This estimator converts descriptors into cross-sectional scores, optionally neutralizes the scores against factor exposures, and combines them with fixed weights to produce an alpha forecast in expected return units.

Unlike EWSharpeOptimalAlpha, the descriptor weights and forecast scale are not estimated from realized returns. They are fixed hyperparameters of the estimator.

For descriptor score \(s_{k,i}\) and signed fixed weight \(w_k\), the composite score for asset \(i\) is:

\[z_i = \frac{\sum_{k \in V_i} w_k s_{k,i}} {\sum_{k \in V_i} |w_k|}\]

where \(V_i\) is the set of descriptors with finite scores for asset \(i\). The forecast in the selected forecast_unit is:

\[\hat y_i = \text{forecast\_scale} \, z_i\]

With forecast_unit=ForecastUnit.IDIO_RETURN, the alpha forecast is:

\[\alpha_i = \hat y_i\]

With forecast_unit=ForecastUnit.IDIO_SHARPE, the forecast is converted to expected return units:

\[\alpha_i = \sigma_i \hat y_i\]

where \(\sigma_i\) is the forecast idiosyncratic volatility.

Parameters:
descriptorslist of (name, estimator) tuples

List of descriptors that compute signals from characteristics.

weightsarray-like of shape (n_descriptors,), optional

Signed descriptor weights. If None, equal positive weights are used. Weights are normalized by their absolute sum. When some descriptor scores are missing, the composite score is renormalized over the available absolute weight.

forecast_scalefloat

Multiplicative scale applied to the composite score in forecast_unit. With ForecastUnit.IDIO_RETURN, this is expected idiosyncratic return per score unit. With ForecastUnit.IDIO_SHARPE, this is idiosyncratic Sharpe per score unit.

forecast_unitForecastUnit, default=ForecastUnit.IDIO_RETURN

Unit of the fixed forecast before conversion to alpha_. The alpha_ attribute is always returned in expected return units. With ForecastUnit.IDIO_SHARPE, idio_variances are required and the forecast is multiplied by current idiosyncratic volatility.

min_coveragefloat, default=0.0

Minimum fraction of absolute descriptor weight that must be finite for the composite score to be computed. Values where available absolute weight is below this threshold are set to NaN. Must be in [0, 1].

neutralize_againstlist of str, optional

Factor names or families to neutralize scores against.

outlier_transformerBaseCSTransformer or “passthrough”, optional

Cross-sectional transformer for descriptor outlier handling. If None, defaults to CSWinsorizer(). Use "passthrough" to skip.

scoring_transformerBaseCSTransformer or “passthrough”, optional

Cross-sectional transformer for descriptor scoring applied after outlier handling. If None, defaults to CSStandardScaler(). Use "passthrough" to skip.

transform_by_groupstr, optional

Name of a categorical characteristic in the AssetPanel to use for group-wise transformations.

n_jobsint, default=1

Number of parallel jobs for descriptor computation.

Attributes:
named_descriptors

Dictionary to access any fitted factors by name.

Methods

fit(X[, y])

Fit descriptors and store the latest alpha forecast in alpha_.

fit_transform(X[, y])

Fit descriptors and return historical alpha forecasts.

get_metadata_routing()

Return metadata routing for descriptor estimators.

get_params([deep])

Get the parameters of an estimator from the ensemble.

partial_fit(X[, y])

Incrementally update descriptors and store the latest alpha forecast.

partial_fit_transform(X[, y])

Incrementally update descriptors and return new alpha forecasts.

set_params(**params)

Set the parameters of a factor from the ensemble.

fit(X, y=None, **fit_params)[source]#

Fit descriptors and store the latest alpha forecast in alpha_.

fit_transform(X, y=None, **fit_params)[source]#

Fit descriptors and return historical alpha forecasts.

get_metadata_routing()#

Return metadata routing for descriptor estimators.

get_params(deep=True)#

Get the parameters of an estimator from the ensemble.

Returns the parameters given in the constructor as well as the estimators contained within the estimators parameter.

Parameters:
deepbool, default=True

Setting it to True gets the various estimators and the parameters of the estimators as well.

Returns:
paramsdict

Parameter and estimator names mapped to their values or parameter names mapped to their values.

property named_descriptors#

Dictionary to access any fitted factors by name.

Returns:
Bunch
partial_fit(X, y=None, **fit_params)[source]#

Incrementally update descriptors and store the latest alpha forecast.

partial_fit_transform(X, y=None, **fit_params)[source]#

Incrementally update descriptors and return new alpha forecasts.

set_params(**params)#

Set the parameters of a factor from the ensemble.

Valid parameter keys can be listed with get_params(). Note that you can directly set the parameters of the estimators contained in estimators.

Parameters:
**paramskeyword arguments

Specific parameters using e.g. set_params(parameter_name=new_value). In addition, to setting the parameters of the estimator, the individual estimator of the estimators can also be set, or can be removed by setting them to ‘drop’.

Returns:
selfobject

Estimator instance.