Hi Denis,
That looks interesting and ambitious.
from zeroguess.integration import ZeroGuessModel
# Enhanced lmfit Model with parameter estimation
model = ZeroGuessModel(
wavelet,
independent_vars_sampling={"x": x_data},
estimator_settings={
"snapshot_path": "model_dg.pth", # saves and loads model automatically
},
)
Is “wavelet” a model function, or is that some part of the learning algorithm? I think it would be helpful to see a use-case with a clearly defined model function.
What is `x_data` and is that needed? Why does this ZeroGuessModel need that?
# Still use your usual parameter hints
model.set_param_hint("frequency", min=0.05, max=1.0)
model.set_param_hint("phase", min=0.0, max=2.0 * np.pi)
model.set_param_hint("position", min=5.0, max=15.0)
model.set_param_hint("width", min=0.1, max=3.0)
Please do not do this.
Parameter hints belong to the Model – like it is right there in the `Model.set_param_hint` call. They are intended to represent cases where a range for a parameter value just makes no sense for the Model. An example would be setting a minimum value for “sigma” to 0 for a Gaussian Model: No matter what the data is, `sigma` is a positive value. GaussianModel works if amplitude=1.3e9, center=34e7, and sigma=803. It also works if amplitude=-80000, center=-2.3, and sigma=0.03. The initial parameters will need to be different, but the model is the same. And sigma < 0 just does not make sense, so the Model disallows it.
Models are independent of data. Parameters made for a model to be used to fit data will need to have values that depend on the data. I would assume that you, writing a library to guess initial values would fully understand this. Bounds on parameters for a particular set of data belong to the parameters. They do not belong to the Model.
Parameter hints for a Model should not be set based on a particular range of data.
If the user is not expected to be able to have good starting values on their own, and needs ZeroGuessModel, what makes you think they will have realistic estimates of the bounds?
In my experience, a really common problem that people have is setting bounds too tightly, often with parameter hints, or setting the bounds based on some heuristics. I would suggest trying to avoid that problem.
Key Benefits:
· Benchmarks show it can match the success rate of global optimizers while using simple local methods (100× faster)
· Once trained, parameter estimation is extremely fast. The model saves to disk, so you only train once.
· It handles the "symmetry problem" (when multiple parameter combinations produce identical output)
It would be interesting to see the benchmarks.
But also (and again), training a model implies that is for some range of data values, and so is dependent on a range of data, which are not part of the Model itself.
--Matt
--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
lmfit-py+u...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/lmfit-py/09f47e01-b2ac-4400-af0c-ddadbe0dee4bn%40googlegroups.com.
--
Is “wavelet” a model function, or is that some part of the learning algorithm? I think it would be helpful to see a use-case with a clearly defined model function.
What is `x_data` and is that needed? Why does this ZeroGuessModel need that?
Parameter hints belong to the Model [...]
It would be interesting to see the benchmarks.
independent_vars_sampling={"x": x_data}
To view this discussion visit https://groups.google.com/d/msgid/lmfit-py/1ce9454e-88f5-4702-9461-597545b418c1n%40googlegroups.com.