Skip to content

Commit

Permalink
use fix and fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Oct 28, 2024
1 parent 4a5eb0c commit b72a963
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/abstractprobprog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,19 @@ end
params,
) -> T
Draw a sample from the joint distribution specified by `model` conditioned on the values in
`params`.
Draw a sample from the predictive distribution specified by `model` with its parameters fixed to `params`.
The sample will be returned as format specified by `T`.
"""
function StatsBase.predict(rand::AbstractRNG, T::Type, model::AbstractProbabilisticProgram, params)
return rand(rng, T, condition(model, params))
function StatsBase.predict(rng::AbstractRNG, T::Type, model::AbstractProbabilisticProgram, params)
return rand(rng, T, fix(model, params))
end
function StatsBase.predict(T::Type, model::AbstractProbabilisticProgram, params)
return StatsBase.predict(Random.default_rng(), T, model, params)
end
function StatsBase.predict(model::AbstractProbabilisticProgram, params)
return StatsBase.predict(NamedTuple, model, params)
end
function StatsBase.predict(rng::AbstractRNG, params)
function StatsBase.predict(rng::AbstractRNG, T::Type, model::AbstractProbabilisticProgram, params)
return StatsBase.predict(rng, NamedTuple, model, params)
end

0 comments on commit b72a963

Please sign in to comment.