class_docstr: A parent class for S-learner classes.
  An S-learner estimates treatment effects with one machine learning model.
  Details of S-learner are available at Kunzel et al. (2018) (https://arxiv.org/abs/1706.03461).
class_docstr_tok: ["A","parent","class","for","S-learner","classes",".","An","S-learner","estimates","treatment","effects","with","one","machine","learning","model",".","Details","of","S-learner","are","available","at","Kunzel","et","al",".","(","2018",")","(","https",":","\/\/arxiv.org\/abs\/1706.03461",")","."]
docstr: Fit the inference model
  Args:
      X (np.matrix, np.array, or pd.Dataframe): a feature matrix
      treatment (np.array or pd.Series): a treatment vector
      y (np.array or pd.Series): an outcome vector
docstr_tok: ["Fit","the","inference","model","Args",":","X","(","np.matrix",",","np.array",",","or","pd.Dataframe",")",":","a","feature","matrix","treatment","(","np.array","or","pd.Series",")",":","a","treatment","vector","y","(","np.array","or","pd.Series",")",":","an","outcome","vector"]
code: def fit(self, X, treatment, y, p=None):
      """Fit the inference model
      Args:
          X (np.matrix, np.array, or pd.Dataframe): a feature matrix
          treatment (np.array or pd.Series): a treatment vector
          y (np.array or pd.Series): an outcome vector
      """
      X, treatment, y = convert_pd_to_np(X, treatment, y)
      check_treatment_vector(treatment, self.control_name)
      self.t_groups = np.unique(
          treatment[treatment != self.control_name]
      )
      self.t_groups.sort()
      self._classes = {
          group: i for i, group in enumerate(self.t_groups)
      }
      self.models = {
          group: deepcopy(self.model) for group in self.t_groups
      }
  
      for group in self.t_groups:
          mask = (treatment == group) | (treatment == self.control_name)
          treatment_filt = treatment[mask]
          X_filt = X[mask]
          y_filt = y[mask]
  
          w = (treatment_filt == group).astype(int)
          X_new = np.hstack((w.reshape((-1, 1)), X_filt))
          self.models[group].fit(X_new, y_filt)
  
imports: import logging
  import numpy
  from tqdm import tqdm
  from scipy.stats import norm
  from sklearn.dummy import DummyRegressor
  import statsmodels.api
  from copy import deepcopy
  from causalml.inference.meta.base import BaseLearner
  from causalml.inference.meta.utils import check_treatment_vector, convert_pd_to_np
  from causalml.metrics import regression_metrics, classification_metrics
label_desc: Use image node_id 3 for calling the BaseSLearner obj's underlying member method code with example usage: obj.fit(X, treatment, y, p) without return types