Skip to content

Commit

Permalink
Add clarifying comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jClugstor authored Dec 14, 2023
1 parent a600ec6 commit dc66674
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ const route2operation_type = Dict(
"ensemble-calibrate" => EnsembleCalibrate
)

# modified from EasyModelAnalysis.jl
function sciml_service_l2loss(pvals, (prob, pkeys, data)::Tuple{Vararg{Any, 3}})
p = Pair.(pkeys, pvals)
ts = first.(last.(data))
Expand All @@ -422,9 +423,10 @@ function sciml_service_l2loss(pvals, (prob, pkeys, data)::Tuple{Vararg{Any, 3}})
end

# assumes data is given in the form column_label => data, need sol_mappings to be of form column_label => observable
# modified from EasyModelAnalysis.jl
function ensemble_weights(sol::SciMLBase.EnsembleSolution, data_ensem, sol_mappings_list)
col = first.(data_ensem)
predictions = reduce(vcat, reduce(hcat,[sol[i][Symbol(sol_mappings_list[i][s])] for i in 1:length(sol)]) for s in col)
data = reduce(vcat, [data_ensem[i][2] isa Tuple ? data_ensem[i][2][2] : data_ensem[i][2] for i in 1:length(data_ensem)])
weights = predictions \ data
end
end

0 comments on commit dc66674

Please sign in to comment.