ciemss / pyciemss

Causal and probabilistic reasoning with continuous time dynamical systems
Other
17 stars 6 forks source link

Optimize should allow observables as the `observed_param` #589

Closed sabinala closed 1 month ago

sabinala commented 3 months ago

Currently, optimize can only use state variables in the QoI, but we should be able to use observables as well.

liunelson commented 2 months ago

@anirban-chaudhuri If we have this feature, along with multiple Optimize constraints/qoi/success criteria, might we be able to solve Scenario 2 Q1 problem of theta >= 2 * epsilon?

That is, edit the model to include a new observable f = theta - 2 * epsilon and choose f as a second constraint (with risk_bound = 0.0) in Optimize?

Something like:

qoi = [lambda y: obs_max_qoi(samples, contexts = ["TotalInfected"]), lambda y: obs_max_qoi(samples, context = ["f"])]

where the two observables were added to the model AMR using MIRA:

model_sidarthe.observables["TotalInfected"] = mira.metamodel.template_model.Observable(
    name = "TotalInfected", 
    expression = sympy.Symbol("Infected") + sympy.Symbol("Diagnosed") + sympy.Symbol("Ailing") + sympy.Symbol("Recognized") + sympy.Symbol("Threatened")
)
model_sidarthe.observables["f"] = mira.metamodel.template_model.Observable(
    name = "f", 
    expression = sympy.Symbol("theta") - 2* sympy.Symbol("epsilon")
)
SamWitty commented 2 months ago

Is this addressed now with https://github.com/ciemss/pyciemss/pull/602?

liunelson commented 2 months ago

This should be it!

anirban-chaudhuri commented 1 month ago

Seems that this is already addressed.