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

Inference Tutorials of a Stochastic Differential Equation runs incorrectly #281

Closed
lilianping opened this issue Dec 21, 2021 · 6 comments
Closed

Comments

@lilianping
Copy link

When I ran the tutorial SDE, I ended up with an error “DimensionMismatch("parent has 101 elements, which is incompatible with size (202,)")” ,Why is this?
image

@rikhuijzer rikhuijzer transferred this issue from TuringLang/Turing.jl Dec 21, 2021
@rikhuijzer
Copy link
Contributor

rikhuijzer commented Dec 21, 2021

I've moved this issue since it is about https://turing.ml/dev/tutorials/10-bayesian-differential-equations/.

Why is this?

The core of this issue is that the Differential Equations tutorial is never evaluated in an automated job because it takes too long to do so. If it would be evaluated regularly, we could have spotted and fixed this issue earlier. The tutorials would be helped by having more computing power available, but efforts such as #280 have stalled.

@rikhuijzer
Copy link
Contributor

@devmotion
Copy link
Member

devmotion commented May 3, 2022

The tutorial was just updated yesterday (#296) and runs fine with the latest versions of Turing and DifferentialEquations (see https://turing.ml/dev/tutorials/10-bayesian-differential-equations/). It's part of our CI pipeline, and hence it should be easy to spot and fix regressions when e.g. updating Turing or DifferentialEquations in the future.

@erinaldi
Copy link

Thanks for the update @devmotion

I may have a small comment about this closed issue.
Even if the code of the SDE part of the tutorial "runs fine", it is using the wrong data in the model
See: https://github.com/TuringLang/TuringTutorials/blob/0e1fa7a385037c59b4f00f0aa521680601472f53/tutorials/10-bayesian-differential-equations/10_bayesian-differential-equations.jmd#L433

It uses the original LV ode data (with gaussian noise) instead of the ensemble of SDE solutions generated in the previous cell.
If we run the SDE model on the ensemble data the likelihood

    for i in 1:length(predicted)
        data[:, i] ~ MvNormal(predicted[i], σ^2 * I)
    end

will fail with

ERROR: BoundsError: attempt to access EnsembleSolution Solution of length 1000 with uType:

@devmotion
Copy link
Member

Well, it was what I wanted to do. The model is written such that the observations are a single trajectory, and the noisy ODE data is one possibility. I viewed the ensembles of SDE solutions merely as an illustration of the SDE behaviour and the stochasticity.

However, https://github.com/TuringLang/TuringTutorials/blob/0e1fa7a385037c59b4f00f0aa521680601472f53/tutorials/10-bayesian-differential-equations/10_bayesian-differential-equations.jmd#L371 indicates that possibly the intention of the original author was different and they wanted to use multiple trajectories instead.

@erinaldi
Copy link

Yes, indeed that is what I think too.
It seems the previous cell is setup to use the entire ensemble, but the model is not.

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

No branches or pull requests

4 participants