Supervised Ensemble Solver#
Module for the supervised ensemble-model solver class.
- class SupervisedEnsembleSolver(problem, models, optimizers=None, schedulers=None, weighting=None, loss=None, use_lt=True)[source]
Bases:
EnsembleSolverEnsemble-model solver for supervised learning problems.
This solver approximates the mapping between input data and target data using an ensemble of models. It is intended for problems whose conditions are defined by input-target pairs and accepts only
InputTargetCondition.Given input samples \(\mathbf{s}_i\), target values \(\mathbf{u}_i\), and an ensemble of models \(\{\mathcal{M}_j\}_{j=1}^{M}\), the prediction of each model is
\[\hat{\mathbf{u}}_{i}^{(j)} = \mathcal{M}_j(\mathbf{s}_i), \qquad j = 1, \ldots, M.\]The supervised training objective minimizes the discrepancy between the target values and the ensemble predictions:
\[\mathcal{L}_{\mathrm{problem}} = \frac{1}{M} \sum_{j=1}^{M} \frac{1}{N} \sum_{i=1}^{N} \mathcal{L} \left( \mathbf{u}_i - \hat{\mathbf{u}}_{i}^{(j)} \right),\]where \(\mathcal{L}\) is the selected loss function, typically the mean squared error.
Initialization of the
SupervisedEnsembleSolverclass.- Parameters:
problem (BaseProblem) – The problem to be solved.
models (torch.nn.Module | list[torch.nn.Module]) – The model or list of models used by the solver.
optimizers (TorchOptimizer | list[TorchOptimizer]) – The optimizer or list of optimizers used by the solver. If
None, thetorch.optim.Adamoptimizer with a learning rate of0.001is used for each model. Default isNone.schedulers (TorchScheduler | list[TorchScheduler]) – The scheduler or list of schedulers used by the solver. If
None, thetorch.optim.lr_scheduler.ConstantLRscheduler with a factor of1.0is used for each model. Default isNone.weighting (BaseWeighting) – The weighting strategy used to combine condition losses. If
None, no weighting is applied. Default isNone.loss – The loss function used to compute residual losses. If
None,torch.nn.MSELossis used. Default isNone.use_lt (bool) – If
True, the solver uses LabelTensors as input. Default isTrue.