JuliaPOMDP / JuliaPOMDP/ParticleFilters.jl

Belief constructors

Open
#12 3 comments 0 reactions 0 assignees View on GitHub
contribution/ learning opportunity
Dominant language
Julia
Stars
48
Forks
17
PR merge metrics
No merged PRs in 30d

Description

It might be nice to have some constructors for the beliefs to answer questions like "how do I make a particle belief from a SparseCat". But, it's not 100% clear which way to do this.

## Approach 1:
```julia
ParticleCollection(d, n::Integer; rng=Base.GLOBAL_RNG) = ParticleCollection([rand(rng, d) for i in 1:n])
```
(and similar for `WeightedParticleBelief`)

## Approach 2:
```julia
function WeightedParticleBelief(d)
pairs = collect(weighted_iterator(d))
return WeightedParticleBelief([first(p) for p in pairs], [last(p) for p in pairs])
end
```

and a similar `ParticleCollection(d, n::Integer=100)` that allocates unweighted particles in proportion to their weight.

----

Approach 2 is nice because it's deterministic and low variance, but it won't work for some distributions (e.g. continuous ones).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.