tssearch.utils package¶
Submodules¶
tssearch.utils.add_personal_distance module¶
-
tssearch.utils.add_personal_distance.
add_distance_json
(distances_path, json_path)[source]¶ Adds new distance to features.json. :param distances_path: Personal Python module directory containing new distances implementation. :type distances_path: string :param json_path: Personal .json file directory containing existing disatnces from TSSEARCH.
New customised distances will be added to file in this directory.
tssearch.utils.distances_settings module¶
-
tssearch.utils.distances_settings.
get_distances_by_type
(domain=None, json_path=None)[source]¶ Creates a dictionary with the features settings by domain. :param domain: Available domains: “statistical”; “spectral”; “temporal”
If domain equals None, then the features settings from all domains are returned.Parameters: json_path (string) – Directory of json file. Default: package features.json directory Returns: Dictionary with the features settings Return type: Dict
tssearch.utils.preprocessing module¶
tssearch.utils.visualisation module¶
-
tssearch.utils.visualisation.
plot_alignment
(ref_signal, estimated_signal, path, **kwargs)[source]¶ This functions plots the resulted alignment of two sequences given the path calculated by the Dynamic Time Warping algorithm.
Parameters: - ref_signal – (array-like) The reference sequence.
- estimated_signal – (array-like) The estimated sequence.
- path – (array-like) A 2D array congaing the path resulted from the algorithm
- **kwargs –
See below:
- offset (
double
) – - The offset used to move the reference signal to an upper position for
visualization purposes.
(default:
2
)
- offset (
- linewidths (
list
) – - A list containing the linewidth for the reference, estimated and connection
plots, respectively.
(default:
[3, 3, 0.5]
)
- linewidths (
- step (
int
) – - The step for
(default:
2
)- step (
- colors (
list
) – A list containing the colors for the reference, estimated and connection plots, respectively. (default:[sns.color_palette()[0], sns.color_palette()[1], 'k']
)
-
tssearch.utils.visualisation.
plot_costmatrix
(matrix, path)[source]¶ This functions overlays the optimal warping path and the cost matrices :param matrix: (ndarray-like)
The cost matrix (local cost or accumulated)Parameters: path – (ndarray-like) The optimal warping path Returns: (void) Plots the optimal warping path with an overlay of the cost matrix.