-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Simple Parameter Estimation Tutorial #305
Conversation
@@ -0,0 +1,102 @@ | |||
# Parameter Estimation | |||
The parameters of a model, generated by Catalyst, can be fitted using various packages available in the Julia ecosystem. Refer [here](https://diffeq.sciml.ai/stable/analysis/parameter_estimation/) for a more detailed description. Below follows a quick tutorial of how a parameter set for a model can be fitted to data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention this tutorial uses [DiffEqFlux] point to docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along those lines perhaps also say that the sciml_train
is using the ADAM
gradient descent method?
Looks great! |
I agree with Chris. Very nice example! |
Only other comment; perhaps show how the estimated parameters compare to the original parameters? |
changes are also tracked in the PR description |
@TorkelE Feel free to skip CI and merge when you are done; it isn't like the tests are relevant to this PR. |
Creates a simple tutorial for estimating a parameter set to a model. Tutorial follows:
Parameter Estimation
The parameters of a model, generated by Catalyst, can be estimated using various packages available in the Julia ecosystem. Refer here for more extensive information. Below follows a quick tutorial of how DiffEqFlux can be used to fit a parameter set to data.
First, we fetch the required packages.
Next, we declare our model. For our example, we will use the Brusselator, a simple oscillator.
We simulate our model, and from the simulation generate sampled data points (with added noise), to which we will attempt to fit a parameter et.
We can plot the real solution, as well as the noisy samples.
Next, we create an optimisation function. For a given initial estimate of the parameter values, p, this function will fit parameter values to our data samples. However, it will only do so on the interval [0,tend].
Next, we will fit a parameter set to the data on the interval [0,10].
We can compare this to the real solution, as well as the sample data
Next, we use this parameter estimation as the input to the next iteration of our fitting process, this time on the interval [0,20].
Finally, we use this estimate as the input to fit a parameter set on the full interval of sampled data.
The final parameter set becomes
[0.9996559014056948, 2.005632696191224]
(the real one was[1.0, 2.0]
).Why we fit the parameters in iterations
The reason we chose to fit the model on a smaller interval to begin with, and then extend the interval, is to avoid getting stuck in a local minimum. Here specifically, we chose our initial interval to be smaller than a full cycle of the oscillation. If we had chosen to fit a parameter set on the full interval immediately we would have received an inferior solution.