wildboar.tree._ptree#

Module Contents#

Classes#

ProximityTreeClassifier

A classifier that uses a k-branching tree based on pivot-time series.

Functions#

ddtw_factory()

dtw_factory()

erp_factory([min_g, max_g, n])

euclidean_factory()

lcss_factory([min_r, max_r, min_threshold, ...])

make_metrics([metric_factories])

msm_factory([min_c, max_c, n])

rddtw_factory([min_r, max_r, n])

rdtw_factory([min_r, max_r, n])

twe_factory([min_penalty, max_penalty, min_stiffness, ...])

wddtw_factory([min_g, max_g, n])

wdtw_factory([min_g, max_g, n])

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.BaseTree

A 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.ddtw_factory()[source]#
wildboar.tree._ptree.dtw_factory()[source]#
wildboar.tree._ptree.erp_factory(min_g=0.0, max_g=1.0, n=10)[source]#
wildboar.tree._ptree.euclidean_factory()[source]#
wildboar.tree._ptree.lcss_factory(min_r=0.0, max_r=0.25, min_threshold=0, max_threshold=1.0, n=10)[source]#
wildboar.tree._ptree.make_metrics(metric_factories=None)[source]#
wildboar.tree._ptree.msm_factory(min_c=0.01, max_c=100, n=10)[source]#
wildboar.tree._ptree.rddtw_factory(min_r=0, max_r=0.25, n=10)[source]#
wildboar.tree._ptree.rdtw_factory(min_r=0, max_r=0.25, n=10)[source]#
wildboar.tree._ptree.twe_factory(min_penalty=1e-05, max_penalty=1.0, min_stiffness=0.0, max_stiffness=0.1, n=10)[source]#
wildboar.tree._ptree.wddtw_factory(min_g=0.0, max_g=1.0, n=10)[source]#
wildboar.tree._ptree.wdtw_factory(min_g=0.0, max_g=1.0, n=10)[source]#