Skip to content

Commit

Permalink
slim down implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Dec 16, 2024
1 parent 58a7931 commit 66bf79e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
Expand Down
20 changes: 2 additions & 18 deletions src/abstractprobprog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,12 @@ end
"""
predict(
[rng::AbstractRNG=Random.default_rng(),]
[T=NamedTuple,]
model::AbstractProbabilisticProgram,
params,
) -> T
)
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(
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, T::Type, model::AbstractProbabilisticProgram, params
)
return StatsBase.predict(rng, NamedTuple, model, params)
return predict(Random.default_rng(), NamedTuple, model, params)
end

0 comments on commit 66bf79e

Please sign in to comment.