Mat
12/16/2025, 5:44 PM# We have two different model functions:
def model_A() -> TrainedModelA: ...
def model_B() -> TrainedModelB: ...
# We have ONE shared evaluation function:
def evaluate(model: AnyTrainedModel) -> float: ...
# How do we use Hamilton to get the results of `evaluate(model_A)` and `evaluate(model_B)`?
When talking about configuration, I mean config.when and then providing the values in for loop to Builder. For the second cast, to avoid code duplication, using something like @parametrize.
I've found model training docs but unfortunately neither of them is describing the pattern I have in mind.
Just to be clear, the goal is to:
a) train multiple models "at once"
b) find out the best of them - usually by looking and comparing the evaluation results in something like MLFlow
Thanks!Stefan Krawczyk
12/16/2025, 10:42 PMStefan Krawczyk
12/16/2025, 10:52 PMMat
12/17/2025, 8:27 AMsubdag abstraction / the whole modular perspective looks very insightful! That looks like a nice building blocks as the size/complexity of the project rises.
For the record, I've settled for @config.when with manual gluing of drivers for now as the setup is fairly simple but subdag looks like a way to go in the future.
Thanks a lot šMat
12/17/2025, 8:31 AM@config.when > @parametrize is that with the later, I would need to annotate also downstream definition which seemed clunky.
I like the fact that with @config.when + gluing of driver, the pipeline definition (code) stays the same and what varies is just runtime configuration (variation of "Build Once, Deploy Anywhere" principle)