tropea_clustering.helpers.reshape_from_dnt¶
- tropea_clustering.helpers.reshape_from_dnt(input_data, delta_t)[source]¶
Reshapes the input data from traditional from scikit format.
Takes the array containing the univariate time-series data in the (n_dims, n_particles, n_frames) format and reshapes it in the format required by scikit-learn (-1, delta_t * n_dims).
- Parameters:
input_data (np.ndarray of shape (n_dims, n_particles, n_frames)) – The data to cluster in the traditional shape.
delta_t (int) – Length of the signal sequence - the analysis time resolution.
- Returns:
reshaped_data – The data to cluster in the scikit-required shape.
- Return type:
np.ndarray of shape (n_particles * n_seq, delta_t * n_dim)
Example
import numpy as np from tropea_clustering import helpers # Select time resolution delta_t = 5 # Create random input data np.random.seed(1234) n_dims = 2 n_particles = 5 n_frames = 1000 input_data = np.random.rand(n_dims, n_particles, n_frames) # Create input array with the scikit-required shape reshaped_input_data = helpers.reshape_from_dnt( input_data, delta_t, )