energy_fault_detector.core.fault_detection_result

class FaultDetectionResult(predicted_anomalies, reconstruction, recon_error, anomaly_score, bias_data=None, arcana_losses=None, tracked_bias=None)

Bases: object

Class to encapsulate results from the fault detection process.

anomaly_score: Series

Series with predicted anomaly scores.

arcana_losses: DataFrame | None = None

DataFrame containing recorded values for all losses in ARCANA. None if ARCANA was not run. Empty if losses were not tracked.

bias_data: DataFrame | None = None

DataFrame with ARCANA results (ARCANA bias). None if ARCANA was not run.

criticality(normal_idx=None, init_criticality=0, max_criticality=1000)

Criticality based on the predicted anomalies.

Parameters:
  • normal_idx (pd.Series, optional) – A pandas Series with boolean values indicating normal operation, indexed by timestamp. Ignored if None.

  • init_criticality (int, optional) – The initial criticality value. Defaults to 0.

  • max_criticality (int, optional) – The maximum criticality value. Defaults to 1000.

Return type:

Series

classmethod load(directory, **kwargs)

Loads the results from CSV files in the specified directory.

Parameters:
  • directory (str | Path) – The directory where the CSV files are stored.

  • kwargs – other keywords args for pd.read_csv (e.g., sep=’,’)

Returns:

The loaded result object.

Return type:

FaultDetectionResult

predicted_anomalies: Series

Series with a predicted anomalies (bool).

recon_error: DataFrame

DataFrame with reconstruction errors.

reconstruction: DataFrame

DataFrame with reconstruction of the input data.

save(directory, **kwargs)

Saves the results to CSV files in the specified directory.

Parameters:
  • directory (str) – The directory where the CSV files will be saved.

  • kwargs – other keywords args for pd.DataFrame.to_csv (i.e. sep=’,’)

Return type:

None

tracked_bias: List[DataFrame] | None = None

List of DataFrames containing the ARCANA bias every 50th iteration. None if ARCANA was not run. Empty if bias was not tracked.

class ModelMetadata(model_date, model_path, train_recon_error, val_recon_error=None)

Bases: object

Class to encapsulate metadata about the FaultDetector model.

model_date: str
model_path: str | Path
train_recon_error: ndarray
val_recon_error: ndarray | None = None