def METHOD_NAME(self, X, y=None):
    """Fits baseline classifier component to data.
    Args:
        X (pd.DataFrame): The input training data of shape [n_samples, n_features].
        y (pd.Series): The target training data of length [n_samples].
    Returns:
        self
    Raises:
        ValueError: If y is None.
    """
    if y is None:
        raise ValueError("Cannot fit Baseline classifier if y is None")
    X = infer_feature_types(X)
    y = infer_feature_types(y)
    vals, counts = np.unique(y, return_counts=True)
    self._classes = list(vals)
    self._percentage_freq = counts.astype(float) / len(y)
    self._num_unique = len(self._classes)
    self._num_features = X.shape[1]
    if self.parameters["strategy"] == "mode":
        self._mode = y.mode()[0]
    return self