Skip to content

Abstract Base Class for all ROM constructors#31

Merged
dsj976 merged 8 commits intomainfrom
refactor/ABC
Apr 9, 2026
Merged

Abstract Base Class for all ROM constructors#31
dsj976 merged 8 commits intomainfrom
refactor/ABC

Conversation

@robertvava
Copy link
Copy Markdown
Collaborator

@robertvava robertvava commented Nov 28, 2025

This PR incorporates and abstract base class (ABC) called DecompositionModel for all ROM constructors (currently TruncatedSVD and OptDMD). DecompositionModel enforces two abstract methods: fit() and reconstruct(). It also contains a method _check_is_fitted() to check if a ROM has been fitted prior to reconstructing or forecasting.

Additionally, this PR replaces logger.exception() with logger.error() where an error is raised outside an exception handler. This is best practice (see here).

Closes #24.

@dsj976 dsj976 changed the title Minimal refactor using Abstract Base Class Abstract Base Class for all ROM constructors Apr 8, 2026
@dsj976 dsj976 self-requested a review April 8, 2026 12:12
@dsj976 dsj976 marked this pull request as ready for review April 8, 2026 12:12
Copy link
Copy Markdown
Collaborator

@dsj976 dsj976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @robertvava, this is great. I have made some minor changes.

@dsj976
Copy link
Copy Markdown
Collaborator

dsj976 commented Apr 8, 2026

@robertvava this needs a last review by you before it can get merged, as I was the last pusher.

@robertvava
Copy link
Copy Markdown
Collaborator Author

Thanks for the changes, looks great!

@dsj976 dsj976 self-requested a review April 9, 2026 09:34
@dsj976 dsj976 merged commit 5f67838 into main Apr 9, 2026
5 checks passed
@dsj976 dsj976 deleted the refactor/ABC branch April 9, 2026 09:47
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.

Incorporate Abstract Base Class for all SVDROM models

2 participants