-
Notifications
You must be signed in to change notification settings - Fork 0
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
Generate stability plots from meta_args #15
Comments
I see. That is indeed relevant. I take it you also want to generally have different priors for different meta config values (I mean for shared parameters), right? The way I would probably go for now, which seems to be on the lines of the dictionary you are implementing right now, would be:
In other words from itertools import product
n_exps = range(2, 6)
t_mins = range(0, 5)
PRIOR_KEYS = ["a", "E"]
def make_prior(n, t_min, key):
return gv.gvar(...)
y = {(n, t_min): Y_DATA[t_min:] for n, t_min in product(n_exps, t_mins)} # assuming Y_DATA is an array
x = {(n, t_min): X_DATA[t_min:] for n, t_min in product(n_exps, t_mins)} # assuming X_DATA is an array
prior = {(n, t_min, key): make_prior(n, t_min, key) for n, t_min, key in product(n_exps, t_mins, PRIOR_KEYS)}
def fcn(x, p):
out = {}
for (n, t_min), xx in x.itmes():
pp = {key: p[(n, t_min, key)] for key in PRIOR_KEYS}
out[(n, t_min)] = ... # some logic here
return out
def stability_plot(fit, **kwargs):
fig = ...
return fig
fit = nonlinear_fit((x, y), fcn=fcn, prior=prior)
gui = FitGUI(fit)
gui.plots.append({"name": "Stability plot", "fcn": stability_plot, "fcn_kwargs": {...}}) Is this also what you have in mind? However, this makes caching a bit harder as the extensive computational part is now on the callbacks (is this already meaningful, here?). And, a priori, they do not know which part to re-run and which one does not change the final result. Right now, without having a custom wrapper for the expansive call (namely |
I'm starting to realize that this might be a bit harder than I originally thought. Even though Using
...and probably other places, too. A useful starting point might be merging def process_fit(fits_dict, prior_flat=None, prior=None, meta_array=None):
meta_config = fits_dict.meta_config
prior = ... # process prior
meta_args = .... # process meta_args
fit_key = ... # generate key from prior, meta_args
return fits_dict[fit_key] with most of the real processing happening inside Import edge case to keep in mind: |
Alternatively, we could just give up on caching fits -- I suspect we'll create orders of magnitude more fits than we'll retrieve, so the gains might be pretty minor anyway. (But if we're generating many fits, we might want to make liberal use of To make the stability plots, we'll still need access to |
Or we could just extend this block of code. # from dashboard.py:get_layout
sidebar = get_sidebar(fit.prior, meta_config=meta_config, meta_values=meta_values)
sidebar.className = "sticky-top bg-light p-4"
content = get_content(fit, name=name, plots=plots) if use_default_content else None
additional_content = get_additional_content(fit) if get_additional_content else None
layout = html.Div(
children=html.Div(
children=[
html.Div(
children=sidebar,
className="col-xs-12 col-sm-5 col-md-4 col-xl-3 col-xxl-2",
id="sticky-sidebar",
),
html.Div(
children=[content, additional_content],
className="col-xs-12 col-sm-7 col-md-8 col-xl-9 col-xxl-10",
),
],
className="row py-3",
),
className="container-fluid",
) For instance, |
In this case, I'd argue stability plots are additional content :) So |
Yup, |
Leaving this issue open as the current draft is not yet discussed & finalized. |
Thinking forward to correlator fits: we would eventually like to be able to make stability plots where we vary the (1) number of states, (2) the starting time, and (3) the ending time. Fortunately all of these variables can be specified in the
meta_args
, as well as their minimum and maximum values.(Ideally we'd like to make stability plots like those in Fig 10 of hep-lat/2011.12166, but I doubt we could generalize this behavior to any
lsqfit.nonlinear_fit
object.)Some ideas on how we could implement this feature:
stability_param='E0'
)Additional goals:
fit1.y == fit2.y
)Cached fit dictionary (haven't tested this, but you get the idea; also, doesn't account for updating priors!)
The text was updated successfully, but these errors were encountered: