MCPcopy Create free account
hub / github.com/huggingface/evaluate / MetricWithMultiLabel

Class MetricWithMultiLabel

tests/test_metric.py:570–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568
569
570class MetricWithMultiLabel(EvaluationModule):
571 def _info(self):
572 return EvaluationModuleInfo(
573 description="dummy metric for tests",
574 citation="insert citation here",
575 features=Features(
576 {"predictions": Sequence(Value("int64")), "references": Sequence(Value("int64"))}
577 if self.config_name == "multilabel"
578 else {"predictions": Value("int64"), "references": Value("int64")}
579 ),
580 )
581
582 def _compute(self, predictions=None, references=None):
583 return (
584 {
585 "accuracy": sum(i == j for i, j in zip(predictions, references)) / len(predictions),
586 }
587 if predictions
588 else {}
589 )
590
591
592@pytest.mark.parametrize(

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…