def METHOD_NAME(self, X, y):
    """Fits the sampler to the data.
    Args:
        X (pd.DataFrame): Input features.
        y (pd.Series): Target.
    Returns:
        self
    Raises:
        ValueError: If y is None.
    """
    if y is None:
        raise ValueError("y cannot be None")
    X_ww = infer_feature_types(X)
    y_ww = infer_feature_types(y)
    self._initialize_sampler(X_ww, y_ww)
    return self