dchackett / taxi

Lightweight portable workflow management system for MCMC applications
MIT License
3 stars 1 forks source link

Parameter inheritance in MCMC subclasses #28

Open dchackett opened 6 years ago

dchackett commented 6 years ago

MCMC tasks that start from other MCMC tasks need to "steal" or inherit parameters from their starter tasks. For instance, a SpectroTask starting from an HMCTask should steal Ns, Nt, kappa to run, as well as any parameters it needs to generate its output filename.

Currently, MCMC parameter inheritance is based on an "inherit by default" scheme: unless an attribute is provided in a list (two lists, in practice), the attribute will be stolen from the parent and written in to the inheriting MCMC task as an attribute. This is dangerous and fails insidiously.

Instead, switch to a scheme where the parameters to inherit must be specified in a list in the class variables, e.g.,

class FlowTask(ConfigMeasurement):
    inherit_params = ['Ns', 'Nt'] + ['beta', 'k4', 'k6', 'label']

where the list has been artificially separated here to illustrate which parameters are physical and which are needed to generate the filename. It may be more useful for inherit_params to be specified as a dictionary to rename inherited params. For example,

class FundamentalSpectroTask(ConfigMeasurement):
    inherit_params = {'k4' : 'kappa', ...}