wildboar.tree._ptree#
Module Contents#
Classes#
A classifier that uses a k-branching tree based on pivot-time series. |
Functions#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- class wildboar.tree._ptree.ProximityTreeClassifier(n_pivot=1, *, criterion='entropy', pivot_sample='label', metric_sample='weighted', metric_factories='default', max_depth=None, min_samples_split=2, min_samples_leaf=1, min_impurity_decrease=0.0, class_weight=None, random_state=None)[source]#
Bases:
wildboar.tree.base.TreeClassifierMixin,wildboar.tree.base.BaseTreeA classifier that uses a k-branching tree based on pivot-time series.
Examples
>>> from wildboar.datasets import load_dataset >>> from wildboar.tree import ProximityTreeClassifier >>> x, y = load_dataset("GunPoint") >>> f = ProximityTreeClassifier( ... n_pivot=10, ... metric_factories={ ... "rdtw": {"min_r": 0.1, "max_r": 0.25}, ... "msm": {"min_c": 0.1, "max_c": 100, "n": 20} ... }, ... "max_criterion="gini" ... ) >>> f.fit(x, y)
References
- Lucas, Benjamin, Ahmed Shifaz, Charlotte Pelletier, Lachlan O’Neill, Nayyar Zaidi, Bart Goethals, François Petitjean, and Geoffrey I. Webb. (2019)
Proximity forest: an effective and scalable distance-based classifier for time series. Data Mining and Knowledge Discovery
- Parameters:
n_pivot (int, optional) – The number of pivots to sample at each node.
criterion ({"entropy", "gini"}, optional) – The impurity criterion.
pivot_sample ({"label", "uniform"}, optional) – The pivot sampling method.
metric_sample ({"uniform", "weighted"}, optional) – The metric sampling method.
metric_factories ("default", list or dict, optional) –
The distance metrics.
If dict, a dictionary where key is:
if str, a named distance factory (See
_DISTANCE_FACTORIES.keys())if callable, a function returning a list of
DistanceMeasure-objects
and where value is a dict of parameters to the factory.
If list, a list of named factories or callables.
If “default”, use the parameterization of (Lucas et.al, 2019)
max_depth (int, optional) – The maximum tree depth.
min_samples_split (int, optional) – The minimum number of samples to consider a split.
min_samples_leaf (int, optional) – The minimum number of samples in a leaf.
min_impurity_decrease (float, optional) – The minimum impurity decrease to build a sub-tree.
class_weight (dict or "balanced", optional) –
Weights associated with the labels.
if dict, weights on the form {label: weight}.
if “balanced” each class weight inversely proportional to the class frequency.
if None, each class has equal weight.
random_state (int or RandomState) –
If int, random_state is the seed used by the random number generator
If RandomState instance, random_state is the random number generator
If None, the random number generator is the RandomState instance used by np.random.
- wildboar.tree._ptree.lcss_factory(min_r=0.0, max_r=0.25, min_threshold=0, max_threshold=1.0, n=10)[source]#