Open dweindl opened 6 months ago
I think, before working on this, we'll need to discuss the desired ensemble functionality in pypesto.
The current ensemble prediction setup is 100% tailored to AMICI
Can we / do we want to generalize that? If not, I would suggest to rename those objects to something like AmiciPredictionResult
/AmiciPredictionConditionResult
to make it very clear that they are only intended to work with AmiciObjective
, AmiciPredictor
, ...
Currently,
pypesto.ensemble.ensemble.Ensemble.predict
is annotated to take apredictor: Callable
. However, it assumes this to be anAmiciPredictor
(or at least to have anamici_objective: AmiciObjective
attribute), .e.g., here: https://github.com/ICB-DCM/pyPESTO/blob/e389257973b063d7e1219abd4b5570f3277ecaa9/pypesto/ensemble/ensemble.py#L855I don't think this is ideal. This makes it unnecessarily cumbersome to create a custom
predictor
, which should just be some callable that takes a parameter vector and parameter IDs and produces aPredictionResult
, or anEnsemblePrediction
.I'd propose:
pypesto.ensemble.ensemble.Ensemble._map_parameters_by_objective
to thepredictor
AmiciPredictor
dependencyAmiciPredictor.__call__
will then need the parameter IDs along with the parameter values. Breaking change.predictor: Callable
topredictor: Callable[[Sequence], PredictionResult]
(and respecting that)pypesto.ensemble.ensemble.Ensemble.predict
altogether, and rather offer that same functionality viaWhateverPredictor.predict(ensemble: pypesto.ensemble.ensemble.Ensemble, ...)
. This seems more appropriate, since different predictors might want to offer different arguments.Predictor
base class that implements the respective functionality that's currently included inpypesto.ensemble.ensemble.Ensemble.predict
.