wildboar#

Wildboar - a library for temporal machine learning.

Wildboar includes numerous temporal machine learning algorithms and seamlessly integrates them with scikit-learn.

Functions#

iseos

Boolean indicator if a value is the end-of-sequence value.

wildboar.annotate#

Annotation of time series.

See the annotation section in the User Guide for more details and examples.

Functions#

motifs

Find motifs.

segment

Find change regimes in a time series.

wildboar.base#

Base classes for all estimators.

Classes#

BaseEstimator

Base estimator for all Wildboar estimators.

CounterfactualMixin

Mixin class for counterfactual explainer.

ExplainerMixin

Mixin class for all explainers in wildboar.

Functions#

is_counterfactual

Check if estimator is a counterfactual explainer.

is_explainer

Check if estimator is an explainer.

wildboar.datasets#

Dataset loading utilities.

See the dataset section in the User Guide for more details and examples.

Examples

>>> from wildboar.datasets import load_dataset
>>> X, y = load_dataset("GunPoint")
>>> X.shape
(200, 60)
Classes#

Bundle

Base class for handling dataset bundles.

JSONRepository

A repository is a collection of bundles.

NpBundle

Bundle of numpy binary files.

Repository

A repository is a collection of bundles.

Functions#

clear_cache

Clear the cache by deleting cached datasets.

get_bundles

Get all bundles in the repository.

get_repository

Get repository by name.

install_repository

Install repository.

list_bundles

Get a list of all bundle names in the specified repository.

list_collections

List the collections of the repository.

list_datasets

List the datasets in the repository.

list_repositories

List the key of all installed repositories.

load_dataset

Load a dataset from a repository.

load_datasets

Load all datasets as a generator.

load_gun_point

Load the GunPoint dataset.

load_synthetic_control

Load the Synthetic_Control dataset.

load_two_lead_ecg

Load the TwoLeadECG dataset.

refresh_repositories

Refresh the installed repositories.

set_cache_dir

Change the global cache directory.

wildboar.datasets.outlier#

Utilities for generating synthetic outlier datasets.

See the User Guide for more details and example uses.

Functions#

density_outliers

Densitiy based outlier generation.

emmott_outliers

Difficulty based outlier generation.

kmeans_outliers

K-mean outlier generation.

majority_outliers

Label the majority class as inliers.

minority_outliers

Label (a fraction of) the minority class as the outlier.

wildboar.datasets.preprocess#

Utilities for preprocessing time series.

Functions#

maxabs_scale

Scale each time series by its maximum absolute value.

minmax_scale

Scale x along the time dimension.

named_preprocess

Get a named preprocessor.

standardize

Scale x along the time dimension.

truncate

Truncate x to the shortest sequence.

wildboar.distance#

Fast distance computations.

The wildboar.distance module includes functions for computing paired and pairwise distances between time series and between time series and subsequences.

See the User Guide for more details and examples.

Classes#

KMeans

KMeans clustering with support for DTW and weighted DTW.

KMedoids

KMedoid algorithm.

KNeighborsClassifier

Classifier implementing k-nearest neighbors.

MDS

Multidimensional scaling.

Functions#

argmin_distance

Find the indicies of the samples with the lowest distance in Y.

argmin_subsequence_distance

Compute the k:th closest subsequences.

distance_profile

Compute the distance profile.

matrix_profile

Compute the matrix profile.

paired_distance

Compute the distance between the i:th time series.

paired_subsequence_distance

Minimum subsequence distance between the i:th subsequence and time series.

paired_subsequence_match

Find matching subsequnces.

pairwise_distance

Compute the distance between subsequences and time series.

pairwise_subsequence_distance

Minimum subsequence distance between subsequences and time series.

subsequence_match

Find matching subsequnces.

wildboar.distance.dtw#

DTW alignment and distance computations.

The wildboar.distance.dtw module implements several functions for computing DTW alignments and distances.

Functions#

ddtw_distance

Compute the derivative dynamic time warping distance.

dtw_alignment

Compute the Dynamic time warping alignment matrix.

dtw_average

Compute the DTW barycenter average (DBA).

dtw_distance

Compute the dynamic time warping distance.

dtw_envelop

Compute the envelop for LB_keogh.

dtw_lb_keogh

LB_keogh lower bound.

dtw_mapping

Optimal warping path between two series or from a given alignment matrix.

jeong_weight

Weighting described by Jeong et. al. (2011)[R4bf7d056babf-1]_.

wddtw_distance

Compute the weighted derivative dynamic time warping distance.

wdtw_alignment

Weighted dynamic time warping alignment.

wdtw_distance

Compute the weighted dynamic time warping distance.

wildboar.ensemble#

Ensemble methods for classification, regression and outlier detection.

Classes#

BaggingClassifier

A bagging classifier.

BaggingRegressor

A bagging regressor.

BaseBagging

Base estimator for Wildboar ensemble estimators.

ElasticEnsembleClassifier

Ensemble of wildboar.distance.KNeighborsClassifier.

ExtraShapeletTreesClassifier

An ensemble of extremely random shapelet trees.

ExtraShapeletTreesRegressor

An ensemble of extremely random shapelet tree regressors.

IntervalForestClassifier

An ensemble of interval tree classifiers.

IntervalForestRegressor

An ensemble of interval tree regressors.

IsolationShapeletForest

An isolation shapelet forest.

PivotForestClassifier

An ensemble of interval tree classifiers.

ProximityForestClassifier

A forest of proximity trees.

RocketForestClassifier

An ensemble of rocket tree classifiers.

RocketForestRegressor

An ensemble of rocket tree regressors.

ShapeletForestClassifier

An ensemble of random shapelet tree classifiers.

ShapeletForestEmbedding

An ensemble of random shapelet trees.

ShapeletForestRegressor

An ensemble of random shapelet tree regressors.

wildboar.explain#

Explanation methods for classifiers and regressors.

Classes#

AmplitudeImportance

Compute the importance of equi-probable amplitude intervals.

FrequencyImportance

Mixin class for all explainers in wildboar.

IntervalImportance

Interval importance for time series.

ShapeletImportance

Compute the importance of shapelets.

Functions#

plot_importances

Plot the importances as a boxplot.

wildboar.explain.counterfactual#

Counterfactual explanations.

The wildboar.explain.counterfactual module includes numerous methods for generating counterfactual explanations.

Classes#

KNeighborsCounterfactual

Fit a counterfactual explainer to a k-nearest neighbors classifier.

PrototypeCounterfactual

Model agnostic approach for constructing counterfactual explanations.

ShapeletForestCounterfactual

Counterfactual explanations for shapelet forest classifiers.

Functions#

counterfactuals

Compute a single counterfactual example for each sample.

proximity

Compute the proximity of the counterfactuals.

wildboar.linear_model#

Linear methods for both classification and regression.

Classes#

CastorClassifier

A dictionary based method using dilated competing shapelets.

DilatedShapeletClassifier

A classifier that uses random dilated shapelets.

HydraClassifier

A Dictionary based method using convolutional kernels.

RandomShapeletClassifier

A classifier that uses random shapelets.

RandomShapeletRegressor

A regressor that uses random shapelets.

RocketClassifier

Implements the ROCKET classifier.

RocketRegressor

Implements the ROCKET regressor.

wildboar.metrics#

Evaluation metrics.

Functions#

compactness_score

Compute compactness score.

plausability_score

Compute plausibility score.

proximity_score

Compute proximity score.

redudancy_score

Compute the redudancy score.

relative_proximity_score

Compute relative proximity score.

silhouette_samples

Compute the Silhouette Coefficient of each samples.

silhouette_score

Compute the mean Silhouette Coefficient of all samples.

validity_score

Compute validity score.

wildboar.model_selection#

Methods for model selection.

Classes#

RepeatedOutlierSplit

Repeated random outlier cross-validator.

Functions#

outlier_train_test_split

Outlier training and testing split from classification dataset.

wildboar.transform#

Transform raw time series to tabular representations.

Classes#

CastorTransform

Competing Dialated Shapelet Transform.

DerivativeTransform

Mixin class for all transformers in scikit-learn.

DiffTransform

Mixin class for all transformers in scikit-learn.

DilatedShapeletTransform

Dilated shapelet transform.

FeatureTransform

Transform a time series as a number of features.

HydraTransform

A Dictionary based method using convolutional kernels.

IntervalTransform

Embed a time series as a collection of features per interval.

MatrixProfileTransform

Matrix profile transform.

PAA

Peicewise aggregate approximation.

PivotTransform

A transform using pivot time series and sampled distance metrics.

ProximityTransform

Transform time series based on class conditional pivots.

RandomShapeletTransform

Random shapelet tranform.

RocketTransform

Transform a time series using random convolution features.

SAX

Symbolic aggregate approximation.

Functions#

convolve

Apply 1D convolution over a time series.

piecewice_aggregate_approximation

Peicewise aggregate approximation.

symbolic_aggregate_approximation

Symbolic aggregate approximation.

wildboar.tree#

Tree-based estimators for classification and regression.

Classes#

ExtraShapeletTreeClassifier

An extra shapelet tree classifier.

ExtraShapeletTreeRegressor

An extra shapelet tree regressor.

IntervalTreeClassifier

An interval based tree classifier.

IntervalTreeRegressor

An interval based tree regressor.

PivotTreeClassifier

A tree classifier that uses pivot time series.

ProximityTreeClassifier

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

RocketTreeClassifier

A tree classifier that uses random convolutions as features.

RocketTreeRegressor

A tree regressor that uses random convolutions as features.

ShapeletTreeClassifier

A shapelet tree classifier.

ShapeletTreeRegressor

A shapelet tree regressor.

wildboar.utils#

Utility functions.

Functions#

check_array

Input validation on time-series.

check_X_y

Check both X and y.