1515from lenskit .basic import PopScorer
1616from lenskit .data import ItemList , ItemListCollection
1717from lenskit .metrics import NDCG , Recall
18- from lenskit .metrics ._base import DecomposedMetric , GlobalMetric , ListMetric , Metric
18+ from lenskit .metrics ._base import GlobalMetric , ListMetric , Metric
1919from lenskit .metrics ._collect import MeasurementCollector , MetricWrapper
2020from lenskit .metrics .basic import ListLength
2121from lenskit .splitting import split_temporal_fraction
@@ -270,28 +270,6 @@ def summarize(self, values):
270270# metricWrapper properties and summarization
271271
272272
273- def test_metricwrapper_is_decomposed_property ():
274- class DummyDecomposed (DecomposedMetric ):
275- label = "dummy_decomp"
276-
277- def compute_list_data (self , recs , test ):
278- return {"a" : 1.0 }
279-
280- def global_aggregate (self , values ):
281- return {"mean" : 1.0 }
282-
283- def measure_list (self , recs , test ):
284- return {"a" : 1.0 }
285-
286- def summarize (self , values ):
287- return {"mean" : 1.0 }
288-
289- wrapper = MetricWrapper (DummyDecomposed (), "decomp" )
290- assert wrapper .is_decomposed
291- wrapper_non = MetricWrapper (ListLength (), "len" )
292- assert not wrapper_non .is_decomposed
293-
294-
295273def test_measure_metric_with_none_summarize ():
296274 """Test metric that returns None from summarize."""
297275
@@ -347,25 +325,6 @@ def test_full_workflow_integration_improved(ml_ds):
347325 assert 0 <= value <= 1
348326
349327
350- # test that global metric raises errors for unsupported operations
351-
352-
353- def test_global_metric_unsupported ():
354- class AnotherGlobalMetric (GlobalMetric ):
355- label = "global"
356-
357- def measure_run (self , run , test ):
358- return 1.0
359-
360- metric = AnotherGlobalMetric ()
361-
362- with raises (NotImplementedError , match = "Global metrics don't support per-list measurement" ):
363- metric .measure_list (ItemList ([1 , 2 ]), ItemList ([1 ]))
364-
365- with raises (NotImplementedError , match = "Global metrics should implement measure_run instead" ):
366- metric .summarize ([1 , 2 , 3 ])
367-
368-
369328# test edge cases in Metric.summarize
370329
371330
@@ -390,19 +349,6 @@ def measure_list(self, output, test):
390349 assert result ["std" ] == 1.0
391350
392351
393- def test_decomposed_metric_numeric_return ():
394- class TestDecomposedMetric (DecomposedMetric ):
395- def compute_list_data (self , output , test ):
396- return len (output )
397-
398- def global_aggregate (self , values ):
399- return 5.0
400-
401- metric = TestDecomposedMetric ()
402- result = metric .summarize ([1 , 2 , 3 ])
403- assert result == {"value" : 5.0 }
404-
405-
406352def test_empty_intermediate_values ():
407353 class TestMetric (Metric ):
408354 label = "test"
0 commit comments