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

WIP: Identifiability with known generic initial conditions #249

Merged
merged 13 commits into from
Feb 5, 2024

Conversation

pogudingleb
Copy link
Collaborator

@pogudingleb pogudingleb commented Nov 22, 2023

This PR adds two functions assess_identifiability_kic and identifiable_functions_kic which take as input, in addition to an ode also a list of functions, for which initial conditions are assumed to be known. In this context, the functions assess identifiability or find all identifiable functions in parameters and initial conditions, respectively.

For example:

using StructuralIdentifiability: assess_identifiability_kic

ode = @ODEmodel(
    x1'(t) = a * x1(t) - b * x1(t) * x2(t),
    x2'(t) = -c * x2(t) + d * x1(t) * x2(t),
    y(t) = x1(t)
)

assess_identifiability_kic(ode, [x2])

will return

OrderedDict{Nemo.fmpq_mpoly, Symbol} with 6 entries:
  x1(0) => :globally
  x2(0) => :globally
  a     => :globally
  b     => :globally
  c     => :globally
  d     => :globally

Algorithmically, first identifiable functions are computed (with_states=true) and then the known initial conditions are added to them as generator of a fields following by an additional simplification step. The computation can be done more efficiently if the generators are added earlier, but this would complicate code quite a bit, not so clear if this is a good idea right now.

What is missing is the version of this functionality for local identifiability.

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 66 lines in your changes are missing coverage. Please review.

Comparison is base (63158d5) 89.81% compared to head (762c568) 73.87%.

❗ Current head 762c568 differs from pull request most recent head bf930bb. Consider uploading reports for the commit bf930bb to get more accurate results

Files Patch % Lines
src/known_ic.jl 0.00% 28 Missing ⚠️
...rc/RationalFunctionFields/RationalFunctionField.jl 0.00% 25 Missing ⚠️
src/util.jl 0.00% 11 Missing ⚠️
src/StructuralIdentifiability.jl 66.66% 1 Missing ⚠️
src/identifiable_functions.jl 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #249       +/-   ##
===========================================
- Coverage   89.81%   73.87%   -15.94%     
===========================================
  Files          27       28        +1     
  Lines        3268     3326       +58     
===========================================
- Hits         2935     2457      -478     
- Misses        333      869      +536     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sumiya11
Copy link
Collaborator

That is nice!
As I understand, these new functions assess identifiability of initial conditions and parameters.

In principle, is it right that we can have a keyword known_ic in assess_identifiability and friends that could, if lucky, improve the identifiability results of some parameters (for example, assess_identifiability(ode, known_ic=[x2]) for the Lotka-Volterra model would return that x2(t) and b are identifiable, which is stronger than the result of assess_identifiability_kic.) ?

@@ -41,6 +41,10 @@ function poly_ring(F::RationalFunctionField)
return parent(first(first(F.dennums)))
end

function generators(F::RationalFunctionField)
return vcat([[f[i] // f[1] for i in 2:length(f)] for f in F.dennums]...)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe dennums_to_fractions

@pogudingleb
Copy link
Collaborator Author

That is nice! As I understand, these new functions assess identifiability of initial conditions and parameters.

In principle, is it right that we can have a keyword known_ic in assess_identifiability and friends that could, if lucky, improve the identifiability results of some parameters (for example, assess_identifiability(ode, known_ic=[x2]) for the Lotka-Volterra model would return that x2(t) and b are identifiable, which is stronger than the result of assess_identifiability_kic.) ?

Yes, the result that x2(t) is identifiable is stronger because this is not just x2(0). Checking this is a trickier task - one should check that the initial conditions of all (sufficiently many would be enough) derivatives of x2 are identifiable.

@pogudingleb pogudingleb merged commit 611027c into master Feb 5, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants