Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fitting functions more generic #52

Closed
cgarling opened this issue Nov 28, 2024 · 2 comments
Closed

Make fitting functions more generic #52

cgarling opened this issue Nov 28, 2024 · 2 comments

Comments

@cgarling
Copy link
Owner

I started with a few basic AMRs but as I start to consider more models it would be useful to formalize a generic interface. The three moving components in the hierarchical models are

  1. the relation between the SFRs and the stellar metallicities (consider the difference between age-metallicity relations and mass-metallicity relations),
  2. the parametric form of the stellar metallicity evolution, and
  3. the model for metallicity dispersion at fixed time.

Part 1 sets the general form for the partial derivatives of the objective with respect to the SFRs -- i.e., for all AMR-type models we could probably use one fit_templates method, if we extract the other parts out.

Part 2 could be abstracted as something like a MetallicityModel type. Need to be able to compute mean metallicity as a function of time, or stellar mass, or whatever other dependent variable you have. Also need gradient -- partial derivatives with respect to fundamental variable and all fittable parameters.

Part 3 could be abstracted as something like a MetallicityDispersion type. Given a mean metallicity and a set of template metallicities, need to compute the relative weights of each. Also need the gradient of the relative weights -- partial derivatives with respect to fundamental variable and all fittable parameters.

Not sure this is worth the time for AMRs but it's more interesting in the case of mass-metallicity relations because there are more parametric forms we may be interested to try, and such a generic setup would require some upfront work to write but would make adding more models later considerably easier.

@cgarling
Copy link
Owner Author

Flatten.jl might be of interest for flattening model structs into formats that can be fed to optimizers.

@cgarling
Copy link
Owner Author

Fixed by #58.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant