The current implementation of bayesflow.trainers.Trainer implements several training strategies in one large class. This can be problematic for both maintainers and users, since
Implementing a new strategy from outside bayesflow requires inheriting from the Trainer class
Modifying small parts of a strategy outside of its input parameters can be difficult or impossible
Maintaining a mental overview over the Trainer functionality is impeded.
We can remedy these issues by implementing the trainer strategies explicitly as their own concept, and following composition over inheritance in the Trainer class.
The current implementation of
bayesflow.trainers.Trainer
implements several training strategies in one large class. This can be problematic for both maintainers and users, sincebayesflow
requires inheriting from theTrainer
classWe can remedy these issues by implementing the trainer strategies explicitly as their own concept, and following composition over inheritance in the Trainer class.