countPaths

dtw.countPaths(d, debug=False)

Count the number of warping paths consistent with the constraints.

Count how many possible warping paths exist in the alignment problem passed as an argument. The object passed as an argument is used to look up the problem parameters such as the used step pattern, windowing, open ends, and so on. The actual alignment is ignored.

Details

Note that the number of paths grows exponentially with problems size. The result may be approximate when windowing functions are used.

If debug=True, a matrix used for the computation is returned instead of the final result.

Parameters:
  • d – an object of class dtw

  • debug – return an intermediate result

Return type:

The number of paths.

Examples

>>> from dtw import *
>>> ds = dtw( numpy.arange(3,10), numpy.arange(1,9),
...           keep_internals=True, step_pattern=asymmetric);
>>> countPaths(ds)
126.0