class_docstr: Overlap Boolean Rule class in the style of scikit-learn
class_docstr_tok: ["Overlap","Boolean","Rule","class","in","the","style","of","scikit-learn"]
docstr: Round the rule coefficients to integer values via a greedy approach, either using a fixed reward
  (`scoring="greedy"`) or optimizing the reward for including positive examples according
  to balanced accuracy on classifying positive vs negative samples (`scoring="greedy_sweep`).
  
  :param X: Pandas DataFrame containing covariates
  :param y: +1 for Overlap/Support (depending on rules being learned), 0 for
      non-overlap, and -1 for background samples.  Should only contain (+1/0) for
      overlap rules, or (+1/-1) for learning support rules.
  :param xi: Reward for including positive samples, relative to cost (1) for including negative samples. For
      `scoring="greedy"`, should be a single value, or an array of values for `scoring="greedy_sweep"`.  For the
      latter, will default to `np.logspace(np.log10(0.01), 0.5, 20)`.
  :param use_lp: Restrict to those conjuctions where the LP coefficients are positive.  Note that the LP makes a
      difference regardless, as we only consider the rules generated by column generation here.
docstr_tok: ["Round","the","rule","coefficients","to","integer","values","via","a","greedy","approach",",","either","using","a","fixed","reward","(","`","scoring=","''","greedy","''","`",")","or","optimizing","the","reward","for","including","positive","examples","according","to","balanced","accuracy","on","classifying","positive","vs","negative","samples","(","`","scoring=","''","greedy_sweep","`",")",".",":","param","X",":","Pandas","DataFrame","containing","covariates",":","param","y",":","+1","for","Overlap\/Support","(","depending","on","rules","being","learned",")",",","0","for","non-overlap",",","and","-1","for","background","samples",".","Should","only","contain","(","+1\/0",")","for","overlap","rules",",","or","(","+1\/-1",")","for","learning","support","rules",".",":","param","xi",":","Reward","for","including","positive","samples",",","relative","to","cost","(","1",")","for","including","negative","samples",".","For","`","scoring=","''","greedy","''","`",",","should","be","a","single","value",",","or","an","array","of","values","for","`","scoring=","''","greedy_sweep","''","`",".","For","the","latter",",","will","default","to","`","np.logspace","(","np.log10","(","0.01",")",",","0.5",",","20",")","`",".",":","param","use_lp",":","Restrict","to","those","conjuctions","where","the","LP","coefficients","are","positive",".","Note","that","the","LP","makes","a","difference","regardless",",","as","we","only","consider","the","rules","generated","by","column","generation","here","."]
code: def round_(
      self,
      X: pd.DataFrame,
      y: Union[np.ndarray, pd.DataFrame],
      scoring: str = "greedy",
      xi=None,
      use_lp: bool = True,
  ):
      """
      Round the rule coefficients to integer values via a greedy approach, either using a fixed reward
      (`scoring="greedy"`) or optimizing the reward for including positive examples according
      to balanced accuracy on classifying positive vs negative samples (`scoring="greedy_sweep`).
  
      :param X: Pandas DataFrame containing covariates
      :param y: +1 for Overlap/Support (depending on rules being learned), 0 for
          non-overlap, and -1 for background samples.  Should only contain (+1/0) for
          overlap rules, or (+1/-1) for learning support rules.
      :param xi: Reward for including positive samples, relative to cost (1) for including negative samples. For
          `scoring="greedy"`, should be a single value, or an array of values for `scoring="greedy_sweep"`.  For the
          latter, will default to `np.logspace(np.log10(0.01), 0.5, 20)`.
      :param use_lp: Restrict to those conjuctions where the LP coefficients are positive.  Note that the LP makes a
          difference regardless, as we only consider the rules generated by column generation here.
      """
      if scoring == "greedy":
          if xi is None:
              xi = 0.5
          self.greedy_round_(X, y, xi=xi, use_lp=use_lp)
  
      elif scoring == "greedy_sweep":
          if xi is None:
              xi = np.logspace(np.log10(0.01), 0.5, 20)
          xis = np.array([xi]).ravel()
          best_xi = xis[0]
          if len(xis) > 1:
              best_xi = None
              best_auc = 0
              for xii in xis:
                  self.greedy_round_(X, y, xi=xii, use_lp=use_lp)
                  auc = roc_auc_score(y, self.predict(X))
                  # Small tolerance on comparisons
                  # This can be useful to break ties and favor larger values of xi
                  if auc > best_auc - 0.001:
                      best_xi = xii
                  if auc > best_auc:
                      best_auc = auc
          self.greedy_round_(X, y, xi=best_xi, use_lp=use_lp)
  
imports: import logging
  from typing import Union
  import cvxpy
  import numpy
  import pandas
  from sklearn.metrics import roc_auc_score
  from .beam_search import beam_search
label_desc: Use image node_id 6 for calling the OverlapBooleanRule obj's underlying member method code with example usage: obj.round_(X, y, scoring, xi, use_lp) without return types