ecal.calculators.preprocessing_flops

FLOP calculators for data preprocessing steps (normalization, min-max scaling, and Gramian Angular/Difference Field encoding).

Classes

GramianDifferenceFieldCalculator()

FLOP calculator for Gramian Angular/Difference Field (GADF) encoding, following the pyts implementation's FLOP profile.

MinMaxScalingCalculator()

FLOP calculator for min-max scaling.

NormalizationCalculator()

FLOP calculator for z-score normalization (mean/std standardization).

PreprocessingFLOPCalculator()

Abstract base class for data-preprocessing FLOP calculators.

class ecal.calculators.preprocessing_flops.GramianDifferenceFieldCalculator[source]

Bases: PreprocessingFLOPCalculator

FLOP calculator for Gramian Angular/Difference Field (GADF) encoding, following the pyts implementation’s FLOP profile.

calculate_flops(data_size, time_steps)[source]

Calculate FLOPs for GADF encoding of time-series data.

Accounts for two min-max scaling passes over the data followed by the pairwise GADF computation across time steps.

Parameters:
  • data_size (int) – Number of independent time-series samples.

  • time_steps (int) – Number of time steps per sample.

Returns:

"total_flops" and "data_shape" ((data_size, time_steps, time_steps), the shape of the resulting GADF matrices).

Return type:

Dict[str, Union[int, Dict]]

class ecal.calculators.preprocessing_flops.MinMaxScalingCalculator[source]

Bases: PreprocessingFLOPCalculator

FLOP calculator for min-max scaling.

calculate_flops(data_size)[source]

Calculate FLOPs for min-max scaling of data_size points.

Accounts for computing max - min once and applying (x - min) / (max - min) to every point.

Parameters:

data_size (int) – Total number of scalar data points to scale.

Returns:

"total_flops" (2 * data_size + 1) and "data_shape" (None, shape is unchanged by scaling).

Return type:

Dict[str, Union[int, Dict]]

class ecal.calculators.preprocessing_flops.NormalizationCalculator[source]

Bases: PreprocessingFLOPCalculator

FLOP calculator for z-score normalization (mean/std standardization).

calculate_flops(data_size)[source]

Calculate FLOPs for z-score normalization of data_size points.

Accounts for computing the mean, standard deviation, and applying (x - mean) / std to every point.

Parameters:

data_size (int) – Total number of scalar data points to normalize.

Returns:

"total_flops" (6 * data_size + 1) and "data_shape" (None, shape is unchanged by normalization).

Return type:

Dict[str, Union[int, Dict]]

class ecal.calculators.preprocessing_flops.PreprocessingFLOPCalculator[source]

Bases: ABC

Abstract base class for data-preprocessing FLOP calculators.

abstractmethod calculate_flops(data_size)[source]

Calculate FLOPs required to preprocess a batch of data.

Parameters:

data_size (int) – Total number of scalar data points to preprocess.

Returns:

"total_flops" and "data_shape".

Return type:

Dict[str, Union[int, Dict]]