class_docstr: Ruleset estimator based on Boolean Rules with Column Generation.
  
  Operates according to an scikit-learn interface with a few additional methods.
class_docstr_tok: ["Ruleset","estimator","based","on","Boolean","Rules","with","Column","Generation",".","Operates","according","to","an","scikit-learn","interface","with","a","few","additional","methods","."]
docstr: Fit rules for either characterizing support (if O is not provided) or for characterizing overlap, in which case
  O should be a vector indicating overlap by 1 and non-overlap by 0.
  
  This function is primarily a wrapper around the OverlapBooleanRule estimator, making sure that features are
  binarized before being fed into the ruleset estimator, constructing reference samples for the support
  characterization, and so on.
  
  :param x: Samples of covariates
  :type x: Pandas DataFrame or Numpy Array, shape (n, d)
  :param o: Binary indicator for whether or not a sample belongs in the overlap region, defaults to None.  If
      provided, should have the same length as `x`
  :type o: Pandas DataFrame or Numpy Array, shape (n, )
docstr_tok: ["Fit","rules","for","either","characterizing","support","(","if","O","is","not","provided",")","or","for","characterizing","overlap",",","in","which","case","O","should","be","a","vector","indicating","overlap","by","1","and","non-overlap","by","0",".","This","function","is","primarily","a","wrapper","around","the","OverlapBooleanRule","estimator",",","making","sure","that","features","are","binarized","before","being","fed","into","the","ruleset","estimator",",","constructing","reference","samples","for","the","support","characterization",",","and","so","on",".",":","param","x",":","Samples","of","covariates",":","type","x",":","Pandas","DataFrame","or","Numpy","Array",",","shape","(","n",",","d",")",":","param","o",":","Binary","indicator","for","whether","or","not","a","sample","belongs","in","the","overlap","region",",","defaults","to","None",".","If","provided",",","should","have","the","same","length","as","`","x","`",":","type","o",":","Pandas","DataFrame","or","Numpy","Array",",","shape","(","n",",",")"]
code: def fit(self, x, o=None):
      """
      Fit rules for either characterizing support (if O is not provided) or for characterizing overlap, in which case
      O should be a vector indicating overlap by 1 and non-overlap by 0.
  
      This function is primarily a wrapper around the OverlapBooleanRule estimator, making sure that features are
      binarized before being fed into the ruleset estimator, constructing reference samples for the support
      characterization, and so on.
  
      :param x: Samples of covariates
      :type x: Pandas DataFrame or Numpy Array, shape (n, d)
      :param o: Binary indicator for whether or not a sample belongs in the overlap region, defaults to None.  If
          provided, should have the same length as `x`
      :type o: Pandas DataFrame or Numpy Array, shape (n, )
      """
  
      n = x.shape[0]
      dim = x.shape[1]
      nRef = int(n * dim * self.n_ref_multiplier)
      if o is None:
          o = np.ones((n,))
  
      # Convert to dataframe if not
      X = (
          x
          if isinstance(x, pd.DataFrame)
          else pd.DataFrame(
              dict([("x%d" % i, x[:, i]) for i in range(x.shape[1])])
          )
      )
  
      # Format labels
      o = (
          o.values.ravel()
          if (isinstance(o, pd.DataFrame) or isinstance(o, pd.Series))
          else o.ravel()
      )
  
      # Sample from reference measure and construct features
      self.refSamples = sample_reference(
          X, n=nRef, seed=self.seed, ref_range=self.ref_range
      )
  
      # Add reference samples
      data = pd.concat([X, self.refSamples], axis=0, sort=False)
      o = np.hstack([o, -np.ones(nRef)])
  
      # Binarize features (fit to data only)
      self.FeatureBinarizer.fit(data.iloc[:n])
      X = self.FeatureBinarizer.transform(data)
  
      # Fit estimator
      self.M.fit(X, o)
  
      # Store reference volume
      if nRef > 0:
          self.relative_volume = self.predict(self.refSamples).mean()
  
      return self
  
file_path: dowhy/dowhy/causal_refuters/overrule/ruleset.py
imports: from typing import Callable, Dict, List, Optional
  import numpy
  import pandas
  from .BCS.load_process_data_BCS import FeatureBinarizer
  from .BCS.overlap_boolean_rule import OverlapBooleanRule
  from .utils import rule_str, sample_reference
label_desc: Use image node_id 5 for calling the BCSRulesetEstimator obj's underlying member method code with example usage: obj.fit(x, o) and returns: self