macrosynergy.learning.forecasting.factor_models#

class PLSTransformer(n_components=2)[source]#

Bases: BaseEstimator, TransformerMixin

Extract PLS components from scikit-learn’s PLSRegression.

Parameters:

n_components (int, default=2) – Number of PLS components to extract.

fit(X, y)[source]#

Fit the PLS model to the data.

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

transform(X)[source]#

Transform the input data to the latent PLS space.

Parameters:

X (pd.DataFrame, pd.Series or np.ndarray) – The input feature matrix to be transformed.

Submodules#