tropea_clustering.helpers.reshape_from_nt¶
- tropea_clustering.helpers.reshape_from_nt(input_data, delta_t)[source]¶
Reshapes the input data from traditional to scikit format.
Takes the array containing the univariate time-series data in the (n_particles, n_frames) format and reshapes it in the format required by scikit-learn (-1, delta_t).
- Parameters:
input_data (np.ndarray of shape (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)
Example
import numpy as np from tropea_clustering import helpers # Select time resolution delta_t = 10 # Create random input data np.random.seed(1234) n_particles = 5 n_frames = 1000 input_data = np.random.rand(n_particles, n_frames) # Create input array with the scikit-required shape reshaped_input_data = helpers.reshape_from_nt( input_data, delta_t, )