integrate_stochastic#

bayesflow.utils.integrate_stochastic(drift_fn: Callable, diffusion_fn: Callable, state: dict[str, int | float | Tensor], start_time: int | float | Tensor, stop_time: int | float | Tensor, steps: int, seed: SeedGenerator, method: str = 'euler_maruyama', **kwargs) dict[str, int | float | Tensor] | tuple[dict[str, int | float | Tensor], dict[str, Sequence[int | float | Tensor]]][source]#

Integrates a stochastic differential equation from start_time to stop_time.

Args:

drift_fn: Function that computes the drift term. diffusion_fn: Function that computes the diffusion term. state: Dictionary containing the initial state. start_time: Starting time for integration. stop_time: Ending time for integration. steps: Number of integration steps. seed: Random seed for noise generation. method: Integration method to use, e.g., ‘euler_maruyama’. **kwargs: Additional arguments to pass to the step function.

Returns:

If return_noise is False, returns the final state dictionary. If return_noise is True, returns a tuple of (final_state, noise_history).