MCPcopy Create free account
hub / github.com/twitter/the-algorithm-ml / test_collections

Function test_collections

core/test_metrics.py:38–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36
37
38def test_collections():
39 max_metric = Max()
40 count_metric = Count()
41 metric = MetricCollection([max_metric, count_metric])
42
43 examples = [{"value": idx} for idx in range(123)]
44 for outputs in examples:
45 metric.update(outputs)
46
47 assert metric.compute() == {
48 max_metric.__class__.__name__: len(examples) - 1,
49 count_metric.__class__.__name__: len(examples),
50 }
51
52
53def test_task_dependent_ctr():

Callers

nothing calls this directly

Calls 3

CountClass · 0.70
updateMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected