MMM.preprocess#

MMM.preprocess(target, data)#

Preprocess the provided data according to the specified target.

This method applies preprocessing methods to the data (“X” or “y”), which are specified in the preprocessing_methods property of this object. It iteratively applies each method in the appropriate list (either for “X” or “y”) to the data.

Parameters:
  • target (str) – Indicates whether the data represents features (“X”) or the target variable (“y”).

  • data (Union[pd.DataFrame, pd.Series, np.ndarray]) – The data to be preprocessed.

Returns:

The preprocessed data.

Return type:

Union[pd.DataFrame, pd.Series, np.ndarray]

Raises:

ValueError – If the target is neither “X” nor “y”.

Example

>>> data = pd.DataFrame({"x1": [1, 2, 3], "y": [4, 5, 6]})
>>> self.preprocess("X", data)