Skip to content

Conversation

@roelofsc
Copy link
Contributor

@roelofsc roelofsc commented Dec 16, 2025

Summary

  • Adds the PreDist notebook (notebooks/PreDist/PreDist.ipynb) showing how to apply the EnergyFaultDetector on the PreDist dataset.
  • Reworks DataPreprocessor to a flexible, steps-based pipeline. This makes it easier to add new steps and data transformers to the framework.
  • Adds CounterDiffTransformer for robust counter-to-diff/rate conversion (resets, rollovers, gap masking).
  • Introduces generate_quickstart_config to create a ready-to-train config (and optional YAML dump).
  • Added the argument features_to_select to the ColumnSelector as alternative to features_to_exclude.
  • Added the argument features_to_clip to the DataClipper as alternative to features_to_exclude.
  • Updates README and docs (configuration guide, examples, docstring fixes) and fixes docs build workflow (pages.yaml).
  • Updates and bugfixes of the notebook Example - Hyperparameter Optimization.ipynb.

Changes

  • DataPreprocessor
    • New steps-based API: DataPreprocessor(steps: Optional[List[Dict]] = None, **legacy_params).
    • STEP_REGISTRY and NAME_ALIASES to add new pipelin steps easily, with the option to add user-friendly aliases.
    • Enforced ordering:
      • NaN-introducing steps (duplicate_to_nan, counter_diff_transformer),
      • column_selector + low_unique_value_filter,
      • other transforms (angle_transformer, …),
      • simple_imputer,
      • scaler (standard_scaler/minmax_scaler; default to StandardScaler if none provided).
    • Validations:
      • Single step definitions enforced for: angle_transformer, column_selector, low_unique_value_filter, simple_imputer and scaler.
      • Auto-assign unique step names when repeated or names collide.
    • Backwards compatibility:
      • Legacy params still supported (old behavior with added counter-diff option).
      • If steps and legacy params are both given, steps take precedence with a warning.

Example config:

train:
   ....
  data_preprocessor:
    steps:
      - name: column_selector
        params:
          max_nan_frac_per_col: 0.2
      - name: low_unique_value_filter
      - name: simple_imputer
      - name: standard_scaler
    ....
  • CounterDiffTransformer (new)

    • Transforms monotonic counters to per-sample increments or per-second rates.
    • Handles resets/rollovers (strategies: zero, rollover, nan, auto), small-negative tolerance, first-sample fill.
    • Optional data gap masking via time-delta threshold (factor of median dt or explicit seconds).
    • Requires DatetimeIndex when compute_rate=True or masking is enabled.
  • Quickstart config generator (new)

    • generate_quickstart_config(...) builds a minimal, valid config dict and can write YAML.
    • _build_preprocessor_steps(...) composes steps for DataPreprocessor.
    • _dump_yaml_if_requested(...) safely writes YAML to disk.
  • Visualisation

    • plot_reconstruction_with_model - Plots the data and its reconstruction using the provided model. Similar to plot_reconstruction, but uses the FaultDetector.predict method to get the reconstruction. Counter values are plottet as diffs or rates with their reconstruction.
  • PreDist

    • Adds the PreDist notebook (notebooks/PreDist/PreDist.ipynb) showing how to apply the EnergyFaultDetector on the PreDist dataset.
    • evaluation.PreDistDataset: A class to (down)load and prepare data from the PreDist dataset.
  • Refactoring

    • The FaultDetectionResult now also has a method to load saved results and a utility method criticality, which wraps the utils.analysis.calculate_criticality function.
    • Some refactoring regarding file handling. All classes now accept pathlib.Path for file paths as well. Start moving from os.path to the pathlib library.
    • Dataframes are now cast to float32 after data preprocessing in the FaultDetector to save memory. If float64 is needed, this can be configured (Config.dtype).
  • Documentation

    • README updated with a quickstart example and CLI mention.
    • New/expanded configuration guide (steps table, examples, defaults, migration notes).
    • Docstring prolems for sphinx-apidoc fixed
    • GitHub Pages generation workflow bug fixed.

roelofsc and others added 26 commits November 11, 2025 11:27
…ough the configuration file, by providing a steps specification instead of a long list of arguments. Extend DataPreprocessor tests with new steps parameter set up.

Also ensures the default values of the DataTransformer classes are the same as the defaults in the DataPreprocessor.
…and update tests and test_data (test configuration files) accordingly
… to complement `features_to_exclude`.

Update the basic configuration.
Fix Docstring in fault_detection_model.py and move initialization of models in fault_detection_result.py here.
Fix Docstring in arcana.py.
…aClipper features_to_exclude and features_to_clip)
…counter diffs/rates if they are present in the reconstruction
…he notebook `notebooks/PreDist/PreDist.ipynb` to show how to apply the EnergyFaultDetector on the PreDist dataset.

Also adds the `criticality` as method to the `FaultDetectionResult`, for easy access and plotting.
Some refactoring: Moving from os.path to pathlib.Path for file handling (wip).
…docstrings and comments in PreDist.ipynb and predist_utils.py.
@roelofsc roelofsc changed the title Refactor DataPreprocessor to steps-based pipeline, add CounterDiffTransformer and quickstart config generator Refactor DataPreprocessor to steps-based pipeline, add CounterDiffTransformer and PreDist notebook Jan 13, 2026
@roelofsc roelofsc marked this pull request as ready for review January 13, 2026 13:59
@roelofsc roelofsc requested a review from cgueck895 January 13, 2026 13:59
@roelofsc roelofsc merged commit 4f5d76d into main Jan 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants