mvtsa.segmentation.BottomUp#
- class mvtsa.segmentation.BottomUp(cost='l2', n_segments=None, penalty=None, max_cost=None, min_size=None, initial_size=None, merge_criterion='increase', cost_params=None)[source]#
Bases:
BaseSegmenterBottom-up segmentation by greedy merging of adjacent segments.
The series is first cut into segments of
initial_sizesamples; the pair of neighbours whose merging increases the total cost least is merged repeatedly. A heap with lazy invalidation makes a run \(O(T/s\,\log(T/s))\) cost evaluations.- Parameters:
- cost
strorcostobject Cost function (see
mvtsa.segmentation.costs).- n_segments
int,optional Stop at this number of segments.
- penalty
float,optional Stop when the smallest cost increase exceeds
penalty.- max_cost
float,optional Stop when the total cost would exceed
max_cost.- min_size
int,optional Minimal segment length (default: the cost’s own minimum).
- initial_size
int,optional Length of the initial segments (default
min_size).- merge_criterion{“increase”, “merged”}
"increase": \(cost(S_l\cup S_r)-cost(S_l)-cost(S_r)\);"merged": \(cost(S_l\cup S_r)\) as in Algorithm 2.1 of Bankó (2015).- cost_params
dict,optional Keyword arguments for a cost given by name.
- cost
- Attributes:
- tree_
MergeTree The complete merge hierarchy (run until one segment remains when no stopping rule is given).
- tree_
Examples using mvtsa.segmentation.BottomUp#
Clustering segments: recurring patterns across series