Skip to content

Commit 165fb8c

Browse files
committed
use prob_thres
1 parent 22a8ae4 commit 165fb8c

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

docs/src/inverse_problems/structural_identifiability.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ nothing # hide
8282
```
8383

8484
### Probability of correctness
85-
The identifiability methods used can, in theory, produce erroneous results. However, it is possible to adjust the lower bound for the probability of correctness using the argument `p` (by default set to `0.99`, that is, at least a $99\%$ chance of correctness). We can e.g. increase the bound through:
85+
The identifiability methods used can, in theory, produce erroneous results. However, it is possible to adjust the lower bound for the probability of correctness using the argument `prob_threshold` (by default set to `0.99`, that is, at least a $99\%$ chance of correctness). We can e.g. increase the bound through:
8686
```example si2
87-
assess_identifiability(goodwind_oscillator; measured_quantities=[:M], p=0.999, loglevel=Logging.Error)
87+
assess_identifiability(goodwind_oscillator; measured_quantities=[:M], prob_threshold=0.999, loglevel=Logging.Error)
8888
nothing # hide
8989
```
90-
giving a minimum bound of $99.9\%$ chance of correctness. In practise, the bounds used by StructuralIdentifiability are very conservative, which means that while the minimum guaranteed probability of correctness in the default case is $99\%$, in practise it is much higher. While increasing the value of `p` increases the certainty of correctness, it will also increase the time required to assess identifiability.
90+
giving a minimum bound of $99.9\%$ chance of correctness. In practise, the bounds used by StructuralIdentifiability are very conservative, which means that while the minimum guaranteed probability of correctness in the default case is $99\%$, in practise it is much higher. While increasing the value of `prob_threshold` increases the certainty of correctness, it will also increase the time required to assess identifiability.
9191

9292
## Local identifiability analysis
9393
Local identifiability can be assessed through the `assess_local_identifiability` function. While this is already determined by `assess_identifiability`, assessing local identifiability only has the advantage that it is easier to compute. Hence, there might be models where global identifiability analysis fails (or takes a prohibitively long time), where instead `assess_local_identifiability` can be used. This function takes the same inputs as `assess_identifiability` and returns, for each quantity, `true` if it is locally identifiable (or `false` if it is not). Here, for the Goodwind oscillator, we assesses it for local identifiability only:

ext/CatalystStructuralIdentifiabilityExtension/structural_identifiability_extension.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ Notes:
6464
"""
6565
function SI.assess_local_identifiability(rs::ReactionSystem, args...; measured_quantities = [],
6666
known_p = [], funcs_to_check = Vector(), remove_conserved = true,
67-
ignore_no_measured_warn=false, kwargs...)
67+
ignore_no_measured_warn=false, prob_threshold = 0.99, kwargs...)
6868
# Creates a ODESystem, list of measured quantities, and functions to check, of SI's preferred form.
6969
osys, conseqs, vars = make_osys(rs; remove_conserved)
7070
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p, conseqs; ignore_no_measured_warn)
7171
funcs_to_check = make_ftc(funcs_to_check, conseqs, vars)
7272

7373
# Computes identifiability and converts it to a easy to read form.
74-
out = SI.assess_local_identifiability(osys, args...; measured_quantities, funcs_to_check, kwargs...)
74+
out = SI.assess_local_identifiability(osys, args...; measured_quantities, funcs_to_check, p=prob_threshold, kwargs...)
7575
return make_output(out, funcs_to_check, reverse.(conseqs))
7676
end
7777

@@ -102,14 +102,14 @@ Notes:
102102
"""
103103
function SI.assess_identifiability(rs::ReactionSystem, args...; measured_quantities = [], known_p = [],
104104
funcs_to_check = Vector(), remove_conserved = true, ignore_no_measured_warn=false,
105-
kwargs...)
105+
prob_threshold = 0.99, kwargs...)
106106
# Creates a ODESystem, list of measured quantities, and functions to check, of SI's preferred form.
107107
osys, conseqs, vars = make_osys(rs; remove_conserved)
108108
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p, conseqs; ignore_no_measured_warn)
109109
funcs_to_check = make_ftc(funcs_to_check, conseqs, vars)
110110

111111
# Computes identifiability and converts it to a easy to read form.
112-
out = SI.assess_identifiability(osys, args...; measured_quantities, funcs_to_check, kwargs...)
112+
out = SI.assess_identifiability(osys, args...; measured_quantities, funcs_to_check, p=prob_threshold, kwargs...)
113113
return make_output(out, funcs_to_check, reverse.(conseqs))
114114
end
115115

@@ -140,13 +140,13 @@ Notes:
140140
"""
141141
function SI.find_identifiable_functions(rs::ReactionSystem, args...; measured_quantities = [],
142142
known_p = [], remove_conserved = true, ignore_no_measured_warn=false,
143-
kwargs...)
143+
prob_threshold = 0.99, kwargs...)
144144
# Creates a ODESystem, and list of measured quantities, of SI's preferred form.
145145
osys, conseqs = make_osys(rs; remove_conserved)
146146
measured_quantities = make_measured_quantities(rs, measured_quantities, known_p, conseqs; ignore_no_measured_warn)
147147

148148
# Computes identifiable functions and converts it to a easy to read form.
149-
out = SI.find_identifiable_functions(osys, args...; measured_quantities, kwargs...)
149+
out = SI.find_identifiable_functions(osys, args...; measured_quantities, p=prob_threshold, kwargs...)
150150
return vector_subs(out, reverse.(conseqs))
151151
end
152152

test/extensions/structural_identifiability.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ let
203203
@test make_si_ode(gw_osc_complt; measured_quantities=[gw_osc_complt.M*gw_osc_complt.E]) isa ODE
204204
end
205205

206+
# Check that `prob_threshold` alternative kwarg works.
207+
let
208+
rs = @reaction_network begin
209+
p, X --> 0
210+
end
211+
212+
assess_identifiability(rs_catalyst; measured_quantities=[rs.X], prob_thres=0.9)
213+
assess_identifiability(rs_catalyst; measured_quantities=[rs.X], prob_thres=0.999)
214+
end
215+
206216
# Tests for hierarchical model with conservation laws at both top and internal levels.
207217
let
208218
# Identifiability analysis for Catalyst model.

0 commit comments

Comments
 (0)