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

docs: clean up few typos and rendering issues #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
ParameterEstimation = "b4cd1eb8-1e24-11e8-3319-93036a3eb9f3"

[compat]
Documenter = "0.27"
Documenter = "0.27"
ModelingToolkit = "8"
ParameterEstimation = "0.3"
4 changes: 1 addition & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ using Pkg
Pkg.add("ParameterEstimation")
```

To

## Citation

TBA

## Feature Summary

- Parameter estimation based on sample data
- Estimated values are reported based on identifiability: local (finitely many), global (unque), unidentifiable.
- Estimated values are reported based on identifiability: local (finitely many), global (unique), unidentifiable.
4 changes: 0 additions & 4 deletions docs/src/library/estimate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
ParameterEstimation.estimate
```

```@docs
ParameterEstimation.estimate
```

```@docs
ParameterEstimation.EstimationResult
```
11 changes: 6 additions & 5 deletions docs/src/tutorials/estimate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ If we collect the sample at 4 time points between 0 and 1, we obtain a collectio

```
"t" => [0.000, 0.333, 0.666, 1.000],
x^2 + x => [2.000, 1.563, 1.229, 0.974]
x^2 + x => [2.000, 1.563, 1.229, 0.974]
```

This is all that is needed for the program: a symbolic model (ODE and outputs) and a dictionary of data.

## Code
Below is the working code example:

```julia
```@example tutorial
using ParameterEstimation
using ModelingToolkit

# Input:
# -- Differential model
# -- MTK model
@parameters mu
@variables t x(t) y(t)
D = Differential(t)
Expand All @@ -36,8 +36,9 @@ outs = [y ~ x^2 + x]
# -- Data
data = Dict(
"t" => [0.000, 0.333, 0.666, 1.000],
x^2 + x => [2.000, 1.563, 1.229, 0.974])
x^2 + x => [2.000, 1.563, 1.229, 0.974]
)

# Run
res = estimate(Sigma, outs, data);
res = estimate(Sigma, outs, data)
```
26 changes: 13 additions & 13 deletions src/estimation/estimate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
estimate(model::ModelingToolkit.ODESystem,
measured_quantities::Vector{ModelingToolkit.Equation},
data_sample::Dict{Any, Vector{T}} = Dict{Any, Vector{T}}();
at_time::T = 0.0, method = :homotopy, solver = Tsit5(),
degree_range = nothing, real_tol = 1e-12,
at_time::T = 0.0, method = :homotopy, solver = Vern9(),
degree_range = nothing, real_tol = 1e-14,
threaded = Threads.nthreads() > 1) where {T <: Float}

Run estimation over a range of interpolation degrees. Return the best estimate according to a heuristic:
- the best estimate is the one with the smallest error between sample data and ODE solution with current parameters (estimates);
Run estimation over a range of interpolation degrees.
Return the best estimate according to a heuristic: the best estimate is the one with the smallest error between sample data and ODE solution with current parameters (estimates).

# Arguments
- `model::ModelingToolkit.ODESystem`: the ODE model;
- `measured_quantities::Vector{ModelingToolkit.Equation}`: the measured quantities (output functions that were sampled experimentally);
- `data_sample::Dict{Any, Vector{T}} = Dict{Any, Vector{T}}()`: the data sample, a dictionary with keys being the measured quantities and
values being the corresponding data. Must include the time vector;
- `at_time::T = 0.0`: the time used for derivative computation;
- `model::ModelingToolkit.ODESystem`: the ODE model.
- `measured_quantities::Vector{ModelingToolkit.Equation}`: the measured quantities (output functions that were sampled experimentally).
- `data_sample::Dict{Any, Vector{T}} = Dict{Any, Vector{T}}()`: the data sample, a dictionary with keys being the measured quantities and values being the corresponding data. \
Must include the time vector.
- `at_time::T = 0.0`: the time used for derivative computation.
- `report_time = nothing`: specify a time T, at which the initial conditions (state variables) will be estimated. If "nothing", use the leftmost time.
- `method = :homotopy`: the method used for polynomial system solving. Can be one of :homotopy (recommended) or :msolve;
- `solver`: the ODE solver used for ODE solution computation (default: Vern9());
- `interpolators = nothing`: the set of interpolators to be used. See examples. If `nothing`, a default is used which includes AAA, FLoater-Hormann, and Fourier interpolations;
- `real_tol` = 1e-14: the tolerance used for real root finding;
- `method = :homotopy`: the method used for polynomial system solving. Can be one of :homotopy (recommended) or :msolve.
- `solver`: the ODE solver used for ODE solution computation (default: Vern9()).
- `interpolators = nothing`: the set of interpolators to be used. See examples. If `nothing`, a default is used which includes AAA, FLoater-Hormann, and Fourier interpolations.
- `real_tol` = 1e-14: the tolerance used for real root finding.
- `threaded = Threads.nthreads() > 1`: whether to use multiple threads for computation (determined automatically).

# Returns
Expand Down
12 changes: 5 additions & 7 deletions src/filtering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ Compute the error between the solution and the data sample. The error is recorde
# Arguments
- `model`: the ODE system to be solved.
- `estimate::EstimationResult`: the parameters and initial conditions of the ODE system.
- `data_sample`: the data sample used for estimation (same functions as `measured_quantities`).
The keys of the dictionary are the measured quantities
and the values are the corresponding data samples.
- `data_sample`: the data sample used for estimation (same functions as `measured_quantities`). \
The keys of the dictionary are the measured quantities and the values are the corresponding data samples.
- `solver = Tsit5()`: (optional) the solver used to solve the ODE system, see `DifferentialEquations` for available solvers.
- `return_ode = false`: (optional) whether to return the ODE solution.

# Returns
- ode_solution: the solution of the ODE system (if `return_ode` is set to `true`).
- `ode_solution`: the solution of the ODE system (if `return_ode` is set to `true`).
- `EstimationResult`: the estimated parameters and initial conditions of the model.
"""
function solve_ode(model, estimate::EstimationResult, inputs::Vector{Equation}, data_sample;
Expand Down Expand Up @@ -89,9 +88,8 @@ In addition, takes into account global and local identifiability of parameters w
- `identifiability_result::IdentifiabilityData`: the result of identifiability analysis.
- `model::ModelingToolkit.ODESystem`: the ODE system.
- `inputs::Vector{ModelingToolkit.Equation}`: the inputs of the ODE system.
- `data_sample::AbstractDict{Any, Vector{T}} = Dict{Any, Vector{T}}()`: the data sample used for estimation (same functions as `measured_quantities`).
The keys of the dictionary are the measured quantities
and the values are the corresponding data samples.
- `data_sample::AbstractDict{Any, Vector{T}} = Dict{Any, Vector{T}}()`: the data sample used for estimation (same functions as `measured_quantities`). \
The keys of the dictionary are the measured quantities and the values are the corresponding data samples.
- `time_interval::Vector{T} = Vector{T}()`: the time interval of the ODE system.
- `topk = 1`: (optional) the number of best estimates to return.

Expand Down
18 changes: 8 additions & 10 deletions src/identifiability/check_identifiability.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
"""
function check_identifiability(ode::ModelingToolkit.ODESystem;
measured_quantities = Array{ModelingToolkit.Equation}[],
inputs::Vector{Num} = Array{Num}[],
infolevel = 0)
check_identifiability(ode::ModelingToolkit.ODESystem;
measured_quantities = Array{ModelingToolkit.Equation}[],
inputs::Vector{Num} = Array{Num}[],
infolevel = 0)

Check identifiability of parameters in the ODE system `ode` using the
algorithm described in [1]. The function returns a `ParameterEstimation.IdentifiabilityData`
object that contains the results of the identifiability analysis.

# Arguments
- `ode::ModelingToolkit.ODESystem`: The ODE system to be analyzed
- `measured_quantities = Array{ModelingToolkit.Equation}[]`: A list of equations
that define the measured quantities. If not provided, the outputs of the ODE
system will be used.
- `inputs::Vector{Num} = Array{Num}[]`: A list of input functions, if any are present.
- `infolevel::Int`: The level of information to be printed during the analysis.
- `ode::ModelingToolkit.ODESystem`: The ODE system to be analyzed.
- `measured_quantities = Array{ModelingToolkit.Equation}[]`: A list of equations that define the measured quantities. If not provided, the outputs of the ODE system will be used.
- `inputs::Vector{Num} = Array{Num}[]`: A list of input functions, if any are present.
- `infolevel::Int`: The level of information to be printed during the analysis.

# References

Expand Down
5 changes: 2 additions & 3 deletions src/rational_interpolation/rational_interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
method::Symbol = :homotopy)

This function performs the key step in parameter estimation.

It interpolates the data in `data_sample` and computes the `TaylorSeries` expansion.
These results are stored in the `Interpolant` object and are applied to the polynomial system in `identifiability_result`.
It interpolates the data in `data_sample` and computes the `TaylorSeries` expansion.
These results are stored in the `Interpolant` object and are applied to the polynomial system in `identifiability_result`.

# Arguments
- `identifiability_result`: the result of the identifiability check.
Expand Down