def METHOD_NAME(self, X, y=None):
    """Transform data using the fitted target encoder.
    Args:
        X (pd.DataFrame): The input training data of shape [n_samples, n_features].
        y (pd.Series, optional): The target training data of length [n_samples].
    Returns:
        pd.DataFrame: Transformed data.
    """
    X_ww = infer_feature_types(X)
    if y is not None:
        y = infer_feature_types(y)
    X_t = self._component_obj.METHOD_NAME(X, y)
    X_t_df = pd.DataFrame(X_t, columns=X_ww.columns, index=X_ww.index)
    no_cat_schema = X_ww.ww.select(exclude="category", return_schema=True)
    X_t_df.ww.init(schema=no_cat_schema)
    return X_t_df