macrosynergy.learning.forecasting.naive_predictors#

class NaiveRegressor[source]#

Bases: BaseEstimator, RegressorMixin

Equally weighted unbiased factor model.

Notes

Given a collection of factors that are theoretically positively correlated with a dependent variable, a plausible signal is a simple average of those factors. This is effectively a linear regression model with zero intercept and equal weights for all factors.

This is a useful benchmark model which works well when the factors are as uncorrelated as possible with one another, because it offers a layer of diversification on the underlying return drivers. When the user has strong priors, this is often a competitive model that is difficult to beat.

However, it is vital for the features to have been preprocessed to have a positive theoretical correlation with the target variable.

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

Fit method.

Parameters:
  • X (pd.DataFrame, pd.Series or np.ndarray) – The input feature matrix.

  • y (pd.DataFrame, pd.Series or np.ndarray) – The target variable.

Returns:

The fitted model.

Return type:

self

Notes

This method involves fully trusting one’s priors and thus requires no learning element. As a consequence, no training set information is needed.

predict(X)[source]#

Predict method.

Notes

The predictions are simply the average of the features across columns of the input feature matrix.

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') NaiveRegressor#

Configure whether metadata should be requested to be passed to the score method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Parameters:

sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for sample_weight parameter in score.

Returns:

self – The updated object.

Return type:

object