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

Class Metric

src/evaluate/module.py:782–809  ·  view source on GitHub ↗

A Metric is the base class and common API for all metrics. Args: config_name (`str`): This is used to define a hash specific to a metric computation script and prevents the metric's data to be overridden when the metric loading script is modified. keep_in

Source from the content-addressed store, hash-verified

780
781
782class Metric(EvaluationModule):
783 """A Metric is the base class and common API for all metrics.
784
785 Args:
786 config_name (`str`):
787 This is used to define a hash specific to a metric computation script and prevents the metric's data
788 to be overridden when the metric loading script is modified.
789 keep_in_memory (`bool`):
790 Keep all predictions and references in memory. Not possible in distributed settings.
791 cache_dir (`str`):
792 Path to a directory in which temporary prediction/references data will be stored.
793 The data directory should be located on a shared file-system in distributed setups.
794 num_process (`int`):
795 Specify the total number of nodes in a distributed settings.
796 This is useful to compute metrics in distributed setups (in particular non-additive metrics like F1).
797 process_id (`int`):
798 Specify the id of the current process in a distributed setup (between 0 and num_process-1)
799 This is useful to compute metrics in distributed setups (in particular non-additive metrics like F1).
800 seed (`int`, *optional*):
801 If specified, this will temporarily set numpy's random seed when [`~evaluate.Metric.compute`] is run.
802 experiment_id (`str`):
803 A specific experiment id. This is used if several distributed evaluations share the same file system.
804 This is useful to compute metrics in distributed setups (in particular non-additive metrics like F1).
805 max_concurrent_cache_files (`int`):
806 Max number of concurrent metric cache files (default `10000`).
807 timeout (`Union[int, float]`):
808 Timeout in second for distributed setting synchronization.
809 """
810
811
812class Comparison(EvaluationModule):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…