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","."]
docstr: Predict the label for the given assignment
  @param assignment: A valuation of the variables that occur in the rule sets
docstr_tok: ["Predict","the","label","for","the","given","assignment","@","param","assignment",":","A","valuation","of","the","variables","that","occur","in","the","rule","sets"]
code: def predict(self, assignment: Dict[str, Any]) -> Any:
      """
      Predict the label for the given assignment
      @param assignment: A valuation of the variables that occur in the rule sets
      """
      if self.rule_selection_method == RuleSelectionMethod.FIRST_HIT:
          for rule in self.rules:
              if rule.conjunction.evaluate(assignment):
                  return rule.label
          return self.default_label
      elif (
          self.rule_selection_method == RuleSelectionMethod.WEIGHTED_SUM
      ):
          assert self.rules[0].weight is not None
          label_weights = {}
          for rule in self.rules:
              if rule.label not in label_weights:
                  label_weights[rule.label] = rule.weight
              else:
                  label_weights[rule.label] += rule.weight
          return max(label_weights, key=label_weights.get)
      elif (
          self.rule_selection_method == RuleSelectionMethod.WEIGHTED_MAX
      ):
          assert self.rules[0].weight is not None
          label_weights = {}
          for rule in self.rules:
              if rule.label not in label_weights:
                  label_weights[rule.label] = rule.weight
              else:
                  label_weights[rule.label] = max(
                      rule.weight, label_weights[rule.label]
                  )
          return max(label_weights, key=label_weights.get)
      else:
          raise ValueError(
              "Unknown rule selection method: {}".format(
                  self.rule_selection_method
              )
          )
  
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 6 for calling the RuleSetClassifier obj's underlying member method code with example usage: obj.predict(assignment) and returns: self, max, rule, max