mvtsa.evaluation.Benchmark#

class mvtsa.evaluation.Benchmark(methods, datasets, task='segmentation', metrics=None)[source]#

Bases: object

Systematic comparison of methods on data sets.

Parameters:
methodsdict name -> factory

A factory returns a fresh method object (e.g. a segmenter class with bound parameters: lambda: PCASegmenter(n_segments=4)).

datasetsdict name -> (data, truth)

For segmentation: (X, change_points); for clustering: (collection, labels).

task{“segmentation”, “clustering”}
metricslist of callables, optional

metric(truth, result) -> dict or float; defaults: evaluate_segmentation() or clustering_scores().

Examples

>>> from mvtsa.datasets import make_piecewise_stationary
>>> from mvtsa.segmentation import BottomUp, PELT
>>> data = {"toy": make_piecewise_stationary(3, 100, 2, random_state=0)[:2]}
>>> res = Benchmark({"bu": lambda: BottomUp("l2", n_segments=3), "pelt": lambda: PELT("l2")}, data).run()
>>> sorted(res["method"].unique())
['bu', 'pelt']
pivot(metric='f1')[source]#

Data sets x methods table of one metric (input of the statistical tests).

Examples using mvtsa.evaluation.Benchmark#

Benchmarking segmenters with statistical tests

Benchmarking segmenters with statistical tests