You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
High-level functions--prep, train, eval, predict, learncurve--now dispatch to lower level functions based on the task and/or dataset
Currently all parameters of the lower level functions must also be parameters of the higher level function, that then passes them in as args
This results in a combinatorial explosion of parameters for the high level function and makes it hard to know which parameters are for which lower level function
We should instead have the high level function accept a params argument that can be one of a set of dataclasses.
E.g., vak.train will accept train_params that can be vak.train.frame_classification.TrainParams or vak.train.dimensionality_reduction.TrainParams.
This will also make it easier to map from a config file to params classes if we use similar levels in the config file, e.g.
NickleDave
changed the title
ENH: Add Params dataclasses for high-level functions
ENH: Add config / params dataclasses for high-level functions
Jan 22, 2024
Use introspection to literally make a dataclass directly from the training function and its type annotations -- this is the Params approach, since we make a dataclass whose attributes are literally the parameters of the function
Write a high-level TrainConfig class and then subclass it. This potentially has all the usual issues with subclassing, with the caveat that these are just attributes and not methods proper so we seem less likely to bang up against those issues. Worst case we might just end up adding/removing attributes a lot.
Either way we should end up with the following:
high-level functions that just take a TrainConfig/TrainParams,
something like this
deftrain(
config: TrainFrameClassificationConfig|TrainParametricUMAPConfig|TrainAvaConfig
)
# validate config is an instance of one of those configs we type hint with, thentrain_kwargs=asdict(config)
ifisinstance(config, TrainFrameClassificationConfig):
train_frame_classification_model(**train_kwargs)
elseif ...
High-level functions--prep, train, eval, predict, learncurve--now dispatch to lower level functions based on the task and/or dataset
Currently all parameters of the lower level functions must also be parameters of the higher level function, that then passes them in as args
This results in a combinatorial explosion of parameters for the high level function and makes it hard to know which parameters are for which lower level function
We should instead have the high level function accept a
params
argument that can be one of a set of dataclasses.E.g.,
vak.train
will accepttrain_params
that can bevak.train.frame_classification.TrainParams
orvak.train.dimensionality_reduction.TrainParams
.This will also make it easier to map from a config file to params classes if we use similar levels in the config file, e.g.
The text was updated successfully, but these errors were encountered: