class_docstr: Macro-average F-Beta score.
  
  This works by computing the F-Beta score per class, and then performs a global average.
  
  Parameters
  ----------
  beta
      Weight of precision in harmonic mean.
  cm
      This parameter allows sharing the same confusion
      matrix between multiple metrics. Sharing a confusion matrix reduces the amount of storage
      and computation time.
  
  Examples
  --------
  
  >>> from river import metrics
  
  >>> y_true = [0, 1, 2, 2, 2]
  >>> y_pred = [0, 0, 2, 2, 1]
  
  >>> metric = metrics.MacroFBeta(beta=.8)
  
  >>> for yt, yp in zip(y_true, y_pred):
  ...     metric.update(yt, yp)
  ...     print(metric)
  MacroFBeta: 100.00%
  MacroFBeta: 31.06%
  MacroFBeta: 54.04%
  MacroFBeta: 54.04%
  MacroFBeta: 48.60%
class_docstr_tok: ["Macro-average","F-Beta","score",".","This","works","by","computing","the","F-Beta","score","per","class",",","and","then","performs","a","global","average",".","Parameters","--","--","--","--","--","beta","Weight","of","precision","in","harmonic","mean",".","cm","This","parameter","allows","sharing","the","same","confusion","matrix","between","multiple","metrics",".","Sharing","a","confusion","matrix","reduces","the","amount","of","storage","and","computation","time",".","Examples","--","--","--","--",">",">",">","from","river","import","metrics",">",">",">","y_true","=","[","0",",","1",",","2",",","2",",","2","]",">",">",">","y_pred","=","[","0",",","0",",","2",",","2",",","1","]",">",">",">","metric","=","metrics.MacroFBeta","(","beta=.8",")",">",">",">","for","yt",",","yp","in","zip","(","y_true",",","y_pred",")",":","...","metric.update","(","yt",",","yp",")","...","print","(","metric",")","MacroFBeta",":","100.00","%","MacroFBeta",":","31.06","%","MacroFBeta",":","54.04","%","MacroFBeta",":","54.04","%","MacroFBeta",":","48.60","%"]
code: def get(self):
      total = 0
      b2 = self.beta**2
  
      for c in self.cm.classes:
          try:
              p = self.cm[c][c] / self.cm.sum_col[c]
          except ZeroDivisionError:
              p = 0
  
          try:
              r = self.cm[c][c] / self.cm.sum_row[c]
          except ZeroDivisionError:
              r = 0
  
          try:
              total += (1 + b2) * p * r / (b2 * p + r)
          except ZeroDivisionError:
              continue
  
      try:
          return total / len(self.cm.classes)
      except ZeroDivisionError:
          return 0.0
  
imports: from __future__ import annotations
  import collections
  import functools
  from river import metrics
label_desc: Use image node_id 2 for calling the MacroFBeta obj's underlying member method code with example usage: obj.get() and returns: unknown, int