wildboar.tree#

Package Contents#

Classes#

ShapeletTreeClassifier

A shapelet tree classifier.

ShapeletTreeRegressor

A shapelet tree regressor.

ExtraShapeletTreeClassifier

An extra shapelet tree classifier.

ExtraShapeletTreeRegressor

An extra shapelet tree regressor.

class wildboar.tree.ShapeletTreeClassifier(max_depth=None, min_samples_split=2, n_shapelets=10, min_shapelet_size=0, max_shapelet_size=1, metric='euclidean', metric_params=None, force_dim=None, random_state=None)#

Bases: sklearn.base.ClassifierMixin, BaseShapeletTree

A shapelet tree classifier.

tree_#

The tree data structure used internally

Type:

Tree

classes_#

The class labels

Type:

ndarray of shape (n_classes,)

n_classes_#

The number of class labels

Type:

int

See also

ShapeletTreeRegressor

A shapelet tree regressor.

ExtraShapeletTreeClassifier

An extra random shapelet tree classifier.

fit(x, y, sample_weight=None, check_input=True)#

Fit a shapelet tree regressor from the training set

Parameters:
  • X (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dimensions, n_timesteps)) – The training time series.

  • y (array-like of shape (n_samples,) or (n_samples, n_classes)) – The target values (class labels) as integers

  • sample_weight (array-like of shape (n_samples,)) – If None, then samples are equally weighted. Splits that would create child nodes with net zero or negative weight are ignored while searching for a split in each node. Splits are also ignored if they would result in any single class carrying a negative weight in either child node.

  • check_input (bool, optional) – Allow to bypass several input checking. Don’t use this parameter unless you know what you do.

Returns:

self

Return type:

object

predict(x, check_input=True)#

Predict the regression of the input samples x.

Parameters:
  • x (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dimensions, n_timesteps])) – The input time series

  • check_input (bool, optional) – Allow to bypass several input checking. Don’t use this parameter unless you know what you do.

Returns:

y – The predicted classes.

Return type:

ndarray of shape (n_samples,)

predict_proba(x, check_input=True)#

Predict class probabilities of the input samples X. The predicted class probability is the fraction of samples of the same class in a leaf.

Parameters:
  • x (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dimensions, n_timesteps])) – The input time series

  • check_input (bool, optional) – Allow to bypass several input checking. Don’t use this parameter unless you know what you do.

Returns:

proba – The class probabilities of the input samples. The order of the classes corresponds to that in the attribute classes_

Return type:

ndarray of shape (n_samples, n_classes)

class wildboar.tree.ShapeletTreeRegressor(*, max_depth=None, min_samples_split=2, n_shapelets=10, min_shapelet_size=0, max_shapelet_size=1, metric='euclidean', metric_params=None, force_dim=None, random_state=None)#

Bases: sklearn.base.RegressorMixin, BaseShapeletTree

A shapelet tree regressor.

tree_#
Type:

Tree

fit(X, y, sample_weight=None, check_input=True)#

Fit a shapelet tree regressor from the training set

Parameters:
  • X (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dimensions, n_timesteps)) – The training time series.

  • y (array-like of shape (n_samples,)) – Target values as floating point values

  • sample_weight (array-like of shape (n_samples,)) – If None, then samples are equally weighted. Splits that would create child nodes with net zero or negative weight are ignored while searching for a split in each node. Splits are also ignored if they would result in any single class carrying a negative weight in either child node.

  • check_input (bool, optional) – Allow to bypass several input checking. Don’t use this parameter unless you know what you do.

Returns:

self

Return type:

object

predict(x, check_input=True)#

Predict the regression of the input samples x.

Parameters:
  • x (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dimensions, n_timesteps])) – The input time series

  • check_input (bool, optional) – Allow to bypass several input checking. Don’t use this parameter unless you know what you do.

Returns:

y – The predicted classes.

Return type:

ndarray of shape (n_samples,)

class wildboar.tree.ExtraShapeletTreeClassifier(max_depth=None, n_shapelets=1, min_samples_split=2, min_shapelet_size=0, max_shapelet_size=1, metric='euclidean', metric_params=None, force_dim=None, random_state=None)#

Bases: ShapeletTreeClassifier

An extra shapelet tree classifier.

Extra shapelet trees are constructed by sampling a distance threshold uniformly in the range [min(dist), max(dist)].

tree_#
Type:

Tree

class wildboar.tree.ExtraShapeletTreeRegressor(*, max_depth=None, n_shapelets=1, min_samples_split=2, min_shapelet_size=0, max_shapelet_size=1, metric='euclidean', metric_params=None, force_dim=None, random_state=None)#

Bases: ShapeletTreeRegressor

An extra shapelet tree regressor.

Extra shapelet trees are constructed by sampling a distance threshold uniformly in the range [min(dist), max(dist)].

tree_#
Type:

Tree