-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Structural Identifiability for Interpolation #219
Comments
Yes structural identifiability can only be performed on a reduced set of models (rational functions). |
The problem is that
Let me know if neither of these helps. |
Hello, i tried both approaches, but neither of them seems to work unfortunately. Do you maybe have another idea ho to fix it? This is my attempt at the moment:
|
Hi @MaAl13 , I would change several things in your script. First of all, you are using Second, some rewriting is needed:
After these transformations (if I did not make any mistakes), the script becomes using DifferentialEquations
using StructuralIdentifiability
using ModelingToolkit
using Symbolics
# Data points
days = [0, 2, 4, 6, 8, 10, 12, 14]
diam = [0, 2, 4, 6, 8, 10, 12, 14].*2
surface = [0, 2, 4, 6, 8, 10, 12, 14]
# Compute the Lagrange polynomial and return as a symbolic expression
function lagrange_poly(t, x_points, y_points)
n = length(x_points)
sum_expr = 0
for i in 1:n
term = y_points[i]
for j in 1:n
if j != i
term *= (t - x_points[j]) / (x_points[i] - x_points[j])
end
end
sum_expr += term
end
return sum_expr
end
# Define the ODE using the Lagrange polynomial
@variables t IB(t) T(t) F(t)
@parameters k gamma thres pow
D = Differential(t)
interp_expr = lagrange_poly(t, days, diam) # Use the computed polynomial here
tmp = substitute(expand_derivatives(D(interp_expr)) / interp_expr, t => T)
eqs = [D(IB) ~ k * (1 - F) - gamma * IB, D(F) ~ pow * F * (1 - F) * tmp, D(T) ~ 1]
ode = ODESystem(eqs, t, name = :name)
assess_identifiability(ode, measured_quantities = [IB, T]) The results is that all the parameters and states are globally identifiable. Since |
Hey @pogudingleb, thank you so much for your incredibly helpful response! Absolutely awesome that you made it work here. I am just trying to run your script with the following package specifications: [0c46a032] DifferentialEquations v7.11.0 But weirdly i get the following error message: ERROR: LoadError: MethodError: no method matching getindex(::Expr, ::Int64) This is weird, because it seems that it is running through in your case. |
@MaAl13 |
I am closing the issue. @MaAl13 feel free to reopen if you will have any further questions. |
It was indeed a typo i think. It now runs for me :) This is absolutely genius, thank you very much. Also for your detailed explanation in the answers! |
@pogudingleb Do you also know a clever way to write dF/dt = k/(1+(G(t)/a)^b+(H(t)/c)^d) in rational form? I so far only managed to do it by including 3 ODEs instead of the original one: Also if i have instead of the Lagrange polynomial only a fraction of two polynomials that is given and only depends on x, not on x_points and y_points, would you include it directly in the equation, or do the same as with the Lagrange polynomial? |
3 ODEs sounds a fair number in this case but I am not sure I understand the particular transformation you have performed. What are your
I would just include it explicitly. |
Alright, thanks. So if i take A(t) = (G(t)/a)^b and B(t) = (H(t) / c)^d i get for the original equation k/(1+A(t)+B(t)) which is then rational you mean? Also just to be sure, since i am loosing the two parameters in my new system i get two new initial conditions for the two new equations. Do they have then a one to one correspondance to the two parameters and if so, which initial condition the corressponds to which parameter, is there a general way to find this out? Also two additional question:
|
There is indeed a some sort of correspondence here: for example, For the summation, I am not sure this can be incorporated in such generality. You can do computation for some fixed For known initial conditions, I have an experimental branch in which you can specify some initial conditions to be assumed to be know under the assumption that their values are generic. Here is the relevant function. |
Okay, i see. So i need to solve the equations with the initial conditions for the unknown parameters. Thank you for providing me with the experimental branch for the initial conditions! I would the put just and array like [A, B, C] in the known_ic argument if A, B and C were states? Also can is still provide then the measured quantities? Also i get from the identifiability the identifiability of the states back, can you maybe tell me how i can interpret this? Does this mean that i will be able to recover the true trajectory given that we don't have any noise in the data? But that would also depend on the number of observations right? Or does this only tell me that the initial conditions are identifiable? |
Also i have massive problems to run the identifiability for the following code
The local identifiability works, but the global one seems to blow up like crzy the memory and doesn't produce a result. Is this even possible in this case? |
Hello, i have the problem that i have a interpolation function on the righthand-side of one of my ODE terms. In order to have an analytical expression for it i used Lagrange polynomials. However, it seem that the StructuralIdentifiability doesn't really work in this case. Here is some example code:
The text was updated successfully, but these errors were encountered: