CUSUM

Cumulative Sum (CUSUM)

@author: smriti.prathapan

class package.cusum.CUSUM

CUSUM class and its functionalities.

change_detection(normalized_ref_value: float = 0.5, normalized_threshold: float = 4) None

Detects a change in the process.

Parameters:
  • pre_change_days (int) – Number of days for in-control phase.

  • normalized_ref_value (float, optional) – Normalized reference value for detecting a unit standard deviation change in mean of the process. Defaults to 0.5.

  • normalized_threshold (float, optional) – Normalized threshold. Defaults to 4.

compute_cusum(x: list[float], mu_0: float, k: float) tuple[list[float], list[float], list[float]]

Compute CUSUM for the observations in x

Parameters:
  • x (list[float]) – Performance metric to be monitored

  • mu_0 (float) – In-control mean of the observations/performance metric

  • k (float) – Reference value related to the magnitude of change that one is interested in detecting

Returns:

Positive cumulative sum, negative cumulative sum, and CUSUM

Return type:

tuple[list[float], list[float], list[float]]

initialize() None

Initialize with the configuration file.

plot_cusum_plotly() Figure

Plot CUSUM value using Plotly

Returns:

CUSUM plot using Plotly graph object.

Return type:

go.Figure

plot_input_metric_plotly() Figure

Plot the input metric using Plotly.

Returns:

Scatter plot as Plotly graph object.

Return type:

go.Figure

plot_input_metric_plotly_raw() Figure

Plot AI output using Plotly.

Returns:

Scatter plot as Plotly graph object.

Return type:

go.Figure

set_df_metric_csv(data_csv: DataFrame) None

Assign the performance metric data to be used for CUSUM.

Parameters:

data_csv (DataFrame or TextFileReader) – A comma-separated values (csv) file is returned as two-dimensional data structure with labeled axes.

set_df_metric_default() None

Read the provided performance metric data to be used for CUSUM for an example.

set_init_stats(init_days: int) None

Use initial days to calculate in-control mean and standard deviation.

Parameters:

init_days (int, optional) – Initial days when observations are considered stable. Defaults to 30.

set_timeline(data: ndarray) None

Set the timeline of observations.

Parameters:

data (np.ndarray) – Data of the metric values across the observations.