class_docstr: Sample-average wrapper.
  
  The provided metric is evaluate on each sample. The arithmetic average over all the samples is
  returned. This is equivalent to using `average='samples'` in scikit-learn.
  
  Parameters
  ----------
  metric
      A classification or a regression metric.
  
  Examples
  --------
  
  >>> from river import metrics
  
  >>> y_true = [
  ...     {0: False, 1: True, 2: True},
  ...     {0: True, 1: True, 2: False}
  ... ]
  >>> y_pred = [
  ...     {0: True, 1: True, 2: True},
  ...     {0: True, 1: False, 2: False}
  ... ]
  
  >>> sample_jaccard = metrics.multioutput.SampleAverage(metrics.Jaccard())
  
  >>> for yt, yp in zip(y_true, y_pred):
  ...     sample_jaccard.update(yt, yp)
  
  >>> sample_jaccard
  SampleAverage(Jaccard): 58.33%
class_docstr_tok: ["Sample-average","wrapper",".","The","provided","metric","is","evaluate","on","each","sample",".","The","arithmetic","average","over","all","the","samples","is","returned",".","This","is","equivalent","to","using","`","average='samples","'","`","in","scikit-learn",".","Parameters","--","--","--","--","--","metric","A","classification","or","a","regression","metric",".","Examples","--","--","--","--",">",">",">","from","river","import","metrics",">",">",">","y_true","=","[","...","{","0",":","False",",","1",":","True",",","2",":","True","}",",","...","{","0",":","True",",","1",":","True",",","2",":","False","}","...","]",">",">",">","y_pred","=","[","...","{","0",":","True",",","1",":","True",",","2",":","True","}",",","...","{","0",":","True",",","1",":","False",",","2",":","False","}","...","]",">",">",">","sample_jaccard","=","metrics.multioutput.SampleAverage","(","metrics.Jaccard","(",")",")",">",">",">","for","yt",",","yp","in","zip","(","y_true",",","y_pred",")",":","...","sample_jaccard.update","(","yt",",","yp",")",">",">",">","sample_jaccard","SampleAverage","(","Jaccard",")",":","58.33","%"]
code: def __init__(self, metric):
      self._metric = metric
      self._avg = stats.Mean()
  
file_path: river/river/metrics/multioutput/sample_average.py
imports: from __future__ import annotations
  from river import metrics, stats, utils
  from river.metrics.multioutput.base import MultiOutputMetric
label_desc: Use image node_id 1 to create a new SampleAverage object from inherited base classes: MultiOutputMetric, metrics.base with example: obj = SampleAverage(metric)