Describe the bug
The error estimation methods inside MultiReducedOrderModel (test_error, kfold_cv_error, loo_error, optimal_mu, reduction_error, and approximation_error) are structurally broken. Because self.database and self.roms are stored as dictionaries in MROM, these methods crash when trying to apply NumPy boolean arrays to slice the dictionary (e.g., executing self.database[indeces] inside loo_error throws a TypeError).
Additionally, MROM is missing the @reduction.deleter and @approximation.deleter decorators. This causes the mrom.save() method to crash with an AttributeError when save_approx=False or save_reduction=False are passed.
To Reproduce
from ezyrb import MultiReducedOrderModel, Database, POD, RBF
import numpy as np
db = Database(np.random.rand(10, 2), np.random.rand(10, 5))
mrom = MultiReducedOrderModel({"p": db}, {"pod": POD()}, {"rbf": RBF()}).fit()
# Bug 1: Crashes due to boolean array indexing on a dictionary
mrom.loo_error()
# Bug 2: Crashes due to missing deleters
mrom.save("test.pkl", save_approx=False)
Output
Database with 5 snapshots and 2 parameters
Traceback (most recent call last):
File "mrom_bug.py", line 9, in <module>
mrom.loo_error()
File "/mnt/raid/kpandey/Kshitij/ITCS/EZyRB/ezyrb/reducedordermodel.py", line 1068, in loo_error
new_db = self.database[indeces]
TypeError: unhashable type: 'numpy.ndarray'
Expected behavior
The error methods in MultiReducedOrderModel must be rewritten to correctly handle dictionary inputs. They should iterate over self.roms and self.database, compute the mathematical errors independently for each model-database pair, and return a dictionary of results. Furthermore, the property deleters must be added so the class can be partially pickled without throwing errors.
Describe the bug
The error estimation methods inside
MultiReducedOrderModel(test_error,kfold_cv_error,loo_error,optimal_mu,reduction_error, andapproximation_error) are structurally broken. Becauseself.databaseandself.romsare stored as dictionaries in MROM, these methods crash when trying to apply NumPy boolean arrays to slice the dictionary (e.g., executingself.database[indeces]insideloo_errorthrows aTypeError).Additionally, MROM is missing the
@reduction.deleterand@approximation.deleterdecorators. This causes themrom.save()method to crash with anAttributeErrorwhensave_approx=Falseorsave_reduction=Falseare passed.To Reproduce
Output
Expected behavior
The error methods in
MultiReducedOrderModelmust be rewritten to correctly handle dictionary inputs. They should iterate over self.roms and self.database, compute the mathematical errors independently for each model-database pair, and return a dictionary of results. Furthermore, the property deleters must be added so the class can be partially pickled without throwing errors.