class_docstr: The `FormulaicTransformer` offers a method to select the right columns from a dataframe as well as a DSL for
  transformations.
  
  It is inspired from R formulas. This is can be useful as a first step in the pipeline.
  
  Parameters
  ----------
  formula : str
      A formulaic-compatible formula.
      Refer to the [formulaic documentation](https://matthewwardrop.github.io/formulaic/guides/grammar/) for more
          details.
  return_type : Literal["pandas", "numpy", "sparse"], default="numpy"
      The type of the returned matrix.
      Refer to the [formulaic documentation](https://matthewwardrop.github.io/formulaic/guides/model_specs/) for more
          details.
  
  Attributes
  ----------
  formula_ : formulaic.Formula
      The parsed formula specification.
  model_spec_ : formulaic.ModelSpec
      The parsed model specification.
  n_features_in_ : int
      Number of features seen during `fit`.
docstr: Transform `X` by generating a model matrix from it based on the fit model spec.
  
  Parameters
  ----------
  X : pd.DataFrame of shape (n_samples, n_features)
      The data for transformation will be applied.
  y: array-like of shape (n_samples,), default=None
      Ignored, present for compatibility.
  
  Returns
  -------
  X : array-like of shape (n_samples, n_features), and type `return_type`
      Transformed data.
  
  Raises
  ------
  ValueError
      If the number of columns from `X` differs from the number of columns when fitting.
docstr_tok: ["Transform","`","X","`","by","generating","a","model","matrix","from","it","based","on","the","fit","model","spec",".","Parameters","--","--","--","--","--","X",":","pd.DataFrame","of","shape","(","n_samples",",","n_features",")","The","data","for","transformation","will","be","applied",".","y",":","array-like","of","shape","(","n_samples",",",")",",","default=None","Ignored",",","present","for","compatibility",".","Returns","--","--","--","-","X",":","array-like","of","shape","(","n_samples",",","n_features",")",",","and","type","`","return_type","`","Transformed","data",".","Raises","--","--","--","ValueError","If","the","number","of","columns","from","`","X","`","differs","from","the","number","of","columns","when","fitting","."]
code: def transform(self, X, y=None):
      """Transform `X` by generating a model matrix from it based on the fit model spec.
  
      Parameters
      ----------
      X : pd.DataFrame of shape (n_samples, n_features)
          The data for transformation will be applied.
      y: array-like of shape (n_samples,), default=None
          Ignored, present for compatibility.
  
      Returns
      -------
      X : array-like of shape (n_samples, n_features), and type `return_type`
          Transformed data.
  
      Raises
      ------
      ValueError
          If the number of columns from `X` differs from the number of columns when fitting.
      """
  
      check_is_fitted(
          self, ["formula_", "model_spec_", "n_features_in_"]
      )
  
      if X.shape[1] != self.n_features_in_:
          raise ValueError(
              "`X` must have the same number of columns in fit and transform. "
              f"Expected {self.n_features_in_}, found {X.shape[1]}."
          )
  
      X_ = self.model_spec_.get_model_matrix(X)
      return X_
  
file_path: scikit-lego/sklego/preprocessing/formulaictransformer.py
imports: from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 3 for calling the FormulaicTransformer obj's underlying member method code with example usage: obj.transform(X, y) and returns: X_