You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently to generate predictions one has to refit the model on missing data, which requires having access to the model object.
It would be quite convenient to be able to update the data of a fitted model using update() (à-la-R), which would allow more flexibility (my use case is that I'm running and saving models locally, and then running some predictions in another step, and currently I need to save the model, the fitted version and the posteriors which is a bit cumbersome).
Is it possible to extract the model object/method from the fitted object? In other words, as far as I understand, a Turing model is often defined as a function (which is hard to serialize), which gets turned into a dynamicPPL object through the @model macro. Can we recover/reconstruct that object from the fitted version?
The text was updated successfully, but these errors were encountered:
Additionally, when I try to save the model using JLD2 and then load it, it throws a warning:
┌ Warning: type Main.#model_LogNormal does not exist in workspace; reconstructing
└ @ JLD2 C:\Users\domma\.julia\packages\JLD2\twZ5D\src\data\reconstructing_datatypes.jl:492
┌ Warning: some parameters could not be resolved for type DynamicPPL.Model{Main.#model_LogNormal,(:rt,),(:min_rt, :isi),(),Tuple{Vector{Float64}},Tuple{Float64, Vector{Float64}},DynamicPPL.DefaultContext}; reconstructing
└ @ JLD2 C:\Users\domma\.julia\packages\JLD2\twZ5D\src\data\reconstructing_datatypes.jl:617
and then errors when using it (the model is of type Reconstruct):
julia> pred = predict(fit([missing for i in 1:nrow(df)]; min_rt=minimum(df.RT), isi=df.ISI), posteriors)
ERROR: MethodError: objects of type JLD2.ReconstructedStatic{Symbol("DynamicPPL.Model{#model_LogNormal,(:rt,),(:min_rt, :isi),(),Tuple{Vector{Float64}},Tuple{Float64, Vector{Float64}},DynamicPPL.DefaultContext}"), (:args, :defaults), Tuple{@NamedTuple{rt::Vector{Float64}}, @NamedTuple{min_rt::Float64, isi::Vector{Float64}}}} are not callable
Stacktrace:
[1] top-level scope
@ c:\Users\domma\Dropbox\RECHERCHE\Studies\DoggoNogo\study1\analysis\2_models_comparison.jl:44
julia> model
Reconstruct@#model_LogNormal()
Currently to generate predictions one has to refit the model on
missing
data, which requires having access to the model object.It would be quite convenient to be able to update the data of a fitted model using
update()
(à-la-R), which would allow more flexibility (my use case is that I'm running and saving models locally, and then running some predictions in another step, and currently I need to save the model, the fitted version and the posteriors which is a bit cumbersome).Would that make sense in Turing? Thanks!
Related, from #2309
The text was updated successfully, but these errors were encountered: