code: def compute_ruleset_complexity(ruleset: DnfRuleSet):
      num_rules = len(ruleset)
      rule_lengths = list(map(len, ruleset.conjunctions))
      max_rule_length = max(rule_lengths)
      sum_rule_length = sum(rule_lengths)
      predicates = []
      for c in ruleset.conjunctions:
          predicates += [p for p in c.predicates if p not in predicates]
      num_distinct_predicates = len(predicates)
      return RuleComplexityMetrics(
          num_rules,
          max_rule_length,
          sum_rule_length,
          num_distinct_predicates,
      )
  
file_path: AIX360/aix360/algorithms/rule_induction/trxf/metrics.py
imports: from collections import namedtuple
  from copy import deepcopy
  from typing import List
  import numpy
  import pandas
  from sklearn.metrics import confusion_matrix
  from aix360.algorithms.rule_induction.trxf.core.dnf_ruleset import DnfRuleSet
  from aix360.algorithms.rule_induction.trxf.core.utils import batch_evaluate
label_desc: Use image node_id 3 for calling a global function with example usage: compute_ruleset_complexity(ruleset) and returns: RuleComplexityMetrics