mvtsa.evaluation.Benchmark#
- class mvtsa.evaluation.Benchmark(methods, datasets, task='segmentation', metrics=None)[source]#
Bases:
objectSystematic comparison of methods on data sets.
- Parameters:
- methods
dictname->factory A factory returns a fresh method object (e.g. a segmenter class with bound parameters:
lambda: PCASegmenter(n_segments=4)).- datasets
dictname-> (data,truth) For segmentation:
(X, change_points); for clustering:(collection, labels).- task{“segmentation”, “clustering”}
- metrics
listofcallables,optional metric(truth, result) -> dict or float; defaults:evaluate_segmentation()orclustering_scores().
- methods
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']