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: Fit the `FormulaicTransformer` to the data by compiling the formula specification into a model spec.
  
  Parameters
  ----------
  X : pd.DataFrame of (n_samples, n_features)
      The data used to compile model spec.
  y : array-like of shape (n_samples,), default=None
      Ignored, present for compatibility.
  
  Returns
  -------
  self : FormulaicTransformer
      The fitted transformer.
  
  Raises
  ------
  ValueError
      If `formula` is not supported.
docstr_tok: ["Fit","the","`","FormulaicTransformer","`","to","the","data","by","compiling","the","formula","specification","into","a","model","spec",".","Parameters","--","--","--","--","--","X",":","pd.DataFrame","of","(","n_samples",",","n_features",")","The","data","used","to","compile","model","spec",".","y",":","array-like","of","shape","(","n_samples",",",")",",","default=None","Ignored",",","present","for","compatibility",".","Returns","--","--","--","-","self",":","FormulaicTransformer","The","fitted","transformer",".","Raises","--","--","--","ValueError","If","`","formula","`","is","not","supported","."]
code: def fit(self, X, y=None):
      """Fit the `FormulaicTransformer` to the data by compiling the formula specification into a model spec.
  
      Parameters
      ----------
      X : pd.DataFrame of (n_samples, n_features)
          The data used to compile model spec.
      y : array-like of shape (n_samples,), default=None
          Ignored, present for compatibility.
  
      Returns
      -------
      self : FormulaicTransformer
          The fitted transformer.
  
      Raises
      ------
      ValueError
          If `formula` is not supported.
      """
      self.formula_ = formulaic.Formula.from_spec(self.formula)
  
      if self.formula_._has_structure:
          raise ValueError(
              f"Formula specification {repr(self.formula_)} results in a structured formula, which is not supported."
          )
  
      self.model_spec_ = self.formula_.get_model_matrix(
          X, output=self.return_type
      ).model_spec
      self.n_features_in_ = X.shape[1]
      return self
  
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 2 for calling the FormulaicTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self