class_docstr: This class implements a simple classifier constructed from a list of DNF rule sets.
  Based on the specified RuleSelectionMethod, this classifier predicts the label for a given input.
class_docstr_tok: ["This","class","implements","a","simple","classifier","constructed","from","a","list","of","DNF","rule","sets",".","Based","on","the","specified","RuleSelectionMethod",",","this","classifier","predicts","the","label","for","a","given","input","."]
code: def _compute_confidence(self, rule):
      if self._confidence_metric is None:
          confidence = None
      elif self._confidence_metric == ConfidenceMetric.LAPLACE:
          confidence = rule.laplace_estimate
      elif self._confidence_metric == ConfidenceMetric.ACCURACY:
          confidence = rule.n_correct / rule.n_records
      elif self._confidence_metric == ConfidenceMetric.CONSTANT:
          confidence = 1
      else:
          raise ValueError(
              "Unknown confidence metric: {}".format(
                  self._confidence_metric
              )
          )
      return confidence
  
imports: import enum
  from collections import namedtuple
  from typing import Dict, List, Any
  import pandas
  from aix360.algorithms.rule_induction.trxf.core.dnf_ruleset import DnfRuleSet
  from aix360.algorithms.rule_induction.trxf.metrics import compute_rule_metrics
label_desc: Use image node_id 7 for calling the RuleSetClassifier obj's underlying member method code with example usage: obj._compute_confidence(rule) and returns: confidence