code: def comp_purity(p_xy, axis):
      max_p = p_xy.max(axis=axis)
      marg_p = p_xy.sum(axis=axis)
      indv_pur = max_p / marg_p
      aggr_pur = max_p.sum()
      return indv_pur, aggr_pur
  
file_path: espnet/egs2/timit/asr1/pyscripts/feats/measure_teacher_quality.py
imports: import argparse
  import re
  from collections import Counter
  import numpy
  from tabulate import tabulate
  from espnet2.utils.types import str2bool
label_desc: Use image node_id 2 for calling a global function with example usage: comp_purity(p_xy, axis) and returns: indv_pur,  aggr_pur