ODESolution

class probnum.diffeq.ODESolution(locations, states, derivatives=None)

Bases: TimeSeriesPosterior

Interface for ODE solutions in ProbNum.

Parameters
  • locations (ndarray) – Locations of the time-grid that was used by the ODE solver.

  • states (_RandomVariableList) – Output of the ODE solver at the locations.

  • derivatives (Optional[_RandomVariableList]) – Derivatives of the states at the locations. Optional. Default is None. Some ODE solvers provide these estimates, others do not.

Attributes Summary

frozen

Whether the posterior is frozen.

locations

Locations of the states of the posterior.

states

States of the posterior.

Methods Summary

__call__(t)

Evaluate the time-continuous posterior at location t

append(location, state)

Append a state to the posterior.

freeze()

Freeze the posterior.

interpolate(t[, previous_index, next_index])

Evaluate the posterior at a measurement-free point.

sample(rng[, t, size])

Sample from the ODE solution.

transform_base_measure_realizations(...)

Transform base-measure-realizations into posteriors samples.

Attributes Documentation

frozen

Whether the posterior is frozen.

locations

Locations of the states of the posterior.

states

States of the posterior.

Methods Documentation

__call__(t)

Evaluate the time-continuous posterior at location t

Algorithm: 1. Find closest t_prev and t_next, with t_prev < t < t_next 2. Predict from t_prev to t 3. (if self._with_smoothing=True) Predict from t to t_next 4. (if self._with_smoothing=True) Smooth from t_next to t 5. Return random variable for time t

Parameters

t (ArrayLike) – Location, or time, at which to evaluate the posterior.

Raises

ValueError – If time-points are not strictly increasing.

Returns

Estimate of the states at time t.

Return type

randvars.RandomVariable or randvars._RandomVariableList

append(location, state)

Append a state to the posterior.

Parameters
Return type

None

freeze()

Freeze the posterior.

Return type

None

interpolate(t, previous_index=None, next_index=None)[source]

Evaluate the posterior at a measurement-free point.

Returns

Dense evaluation.

Return type

randvars.RandomVariable or randvars._RandomVariableList

Parameters
sample(rng, t=None, size=())[source]

Sample from the ODE solution.

Parameters
Return type

ndarray

transform_base_measure_realizations(base_measure_realizations, t)[source]

Transform base-measure-realizations into posteriors samples.

Parameters
Returns

Transformed realizations.

Return type

np.ndarray