Skip to content

AlignerDtwDtai

AlignerDtwDtai

class AlignerDtwDtai(use_c=False, window=None, max_dist=None, max_step=None, max_length_diff=None, penalty=None, psi=None, inner_dist='squared euclidean')[source]

Aligner interface for dtaidistance time warping alignment.

Direct interface to dtaidistance.dtw_ndim.warping_path and dtaidistance.dtw_ndim.warping_path_fast.

This distance is covers multivariate data and arbitrary scalar distances as components.

Parameters:
use_c: bool, optional, default=False

Whether to use the faster C variant: True for C, False for Python. True requires a C compiled installation of dtaidistance.

  • If False, uses dtaidistance.dtw_ndim.distance_matrix.

  • If True, uses dtaidistance.dtw_ndim.distance_matrix_fast.

windowinteger, optional, default=infinite

Sakoe Chiba window width, from diagonal to boundary. Only allow for maximal shifts from the two diagonals smaller than this number. The maximally allowed warping, thus difference between indices i in series 1 and j in series 2, is thus |i-j| < 2*window + |len(s1) - len(s2)|. It includes the diagonal, meaning that Euclidean distance is obtained by setting window=1. If the two series are of equal length, this means that the band appearing on the cumulative cost matrix is of width 2*window-1. In other definitions of DTW this number may be referred to as the window instead.

max_dist: float, optional, default=infinite

Stop if the returned values will be larger than this value.

max_step: float, optional, default=infinite

Do not allow steps larger than this value. If the difference between two values in the two series is larger than this, thus if |s1[i]-s2[j]| > max_step, replace that value with infinity.

max_length_diff: int, optional, default=infinite

Return infinity if difference of length of two series is larger than this value.

penalty: float, optional, default=0

Penalty to add if compression or expansion is applied

psi: integer or 4-tuple of integers or none, optional, default=none

Psi relaxation parameter (ignore start and end of matching). If psi is a single integer, it is used for both start and end relaxations for both series in a pair of series. If psi is a 4-tuple, it is used as the psi-relaxation for (begin series1, end series1, begin series2, end series2). Useful for cyclical series.

inner_dist: str, or sktime BasePairwiseTransformer, default=”squared euclidean”

Distance between two points in the time series.

  • If str, must be one of ‘squared euclidean’ (default), ‘euclidean’.

  • if estimator, must follow sktime BasePairwiseTransformer API. For a range of distances from scipy, see ScipyDist.

Attributes:
is_fitted

Whether fit has been called.

References

[1]

H. Sakoe, S. Chiba, “Dynamic programming algorithm optimization for spoken word recognition,” IEEE Transactions on Acoustics, Speech and Signal Processing, vol. 26(1), pp. 43–49, 1978.

Methods

check_is_fitted([method_name])

Check if the estimator has been fitted.

clone()

Obtain a clone of the object with same hyper-parameters and config.

clone_tags(estimator[, tag_names])

Clone tags from another object as dynamic override.

create_test_instance([parameter_set])

Construct an instance of the class, using first test parameter set.

create_test_instances_and_names([parameter_set])

Create list of all test instances and a list of names for them.

fit(X[, Z])

Fit alignment given series/sequences to align.

get_aligned()

Return aligned version of sequences passed to fit.

get_alignment()

Return alignment for sequences/series passed in fit (iloc indices).

get_alignment_loc()

Return alignment for sequences/series passed in fit (loc indices).

get_class_tag(tag_name[, tag_value_default])

Get class tag value from class, with tag level inheritance from parents.

get_class_tags()

Get class tags from class, with tag level inheritance from parent classes.

get_config()

Get config flags for self.

get_distance()

Return overall distance of alignment.

get_distance_matrix()

Return distance matrix of alignment.

get_fitted_params([deep])

Get fitted parameters.

get_param_defaults()

Get object's parameter defaults.

get_param_names([sort])

Get object's parameter names.

get_params([deep])

Get a dict of parameters values for this object.

get_tag(tag_name[, tag_value_default, ...])

Get tag value from instance, with tag level inheritance and overrides.

get_tags()

Get tags from instance, with tag level inheritance and overrides.

get_test_params([parameter_set])

Test parameters for aligner.

is_composite()

Check if the object is composed of other BaseObjects.

load_from_path(serial)

Load object from file location.

load_from_serial(serial)

Load object from serialized memory container.

reset()

Reset the object to a clean post-init state.

save([path, serialization_format])

Save serialized self to bytes-like object or to (.zip) file.

set_config(**config_dict)

Set config flags to given values.

set_params(**params)

Set the parameters of this object.

set_random_state([random_state, deep, ...])

Set random_state pseudo-random seed parameters for self.

set_tags(**tag_dict)

Set instance level tag overrides to given values.