From db6fed4454096a87e8be9dc1a3642e9950ff9bda Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 6 Feb 2021 01:26:45 -0500 Subject: [PATCH] Fix loglikelihood iterations --- src/cost_functions.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cost_functions.jl b/src/cost_functions.jl index 9ee9f5d5..d4192785 100644 --- a/src/cost_functions.jl +++ b/src/cost_functions.jl @@ -170,14 +170,14 @@ function (f::LogLikeLoss)(sol::DESolution) ll = 0.0 if eltype(distributions) <: UnivariateDistribution - for j in 1:length(f.t), i in 1:length(sol[1][1]) + for j in 1:length(f.t), i in 1:length(sol[1]) # i is the number of time points # j is the size of the system # corresponds to distributions[i,j] ll -= logpdf(distributions[i,j],sol[i,j]) end else # MultivariateDistribution - for j in 1:length(f.t), i in 1:length(sol[1][1]) + for j in 1:length(f.t), i in 1:length(sol[1]) # i is the number of time points # j is the size of the system # corresponds to distributions[i,j] @@ -218,7 +218,7 @@ function (f::LogLikeLoss)(sol::DiffEqBase.AbstractEnsembleSolution) failure && return Inf ll = 0.0 if eltype(distributions) <: UnivariateDistribution - for j in 1:length(f.t), i in 1:length(sol[1][1]) + for j in 1:length(f.t), i in 1:length(sol[1]) # i is the number of time points # j is the size of the system # corresponds to distributions[i,j] @@ -230,7 +230,7 @@ function (f::LogLikeLoss)(sol::DiffEqBase.AbstractEnsembleSolution) # i is the number of time points # j is the size of the system # corresponds to distributions[i,j] - vals = [s[i,j] for i in 1:length(sol[1][1]), s in sol] + vals = [s[i,j] for i in 1:length(sol[1]), s in sol] ll -= loglikelihood(distributions[j],vals) end end @@ -245,7 +245,7 @@ function (f::LogLikeLoss)(sol::DiffEqBase.AbstractEnsembleSolution) end else for j in 2:length(f.t) - vals = [s[i,j] - s[i,j-1] for i in 1:length(sol[1][1]), s in sol] + vals = [s[i,j] - s[i,j-1] for i in 1:length(sol[1]), s in sol] fdll -= logpdf(distributions[j-1],vals)[1] end end