# Change the number of particles in the PF dynamically

**URL:** <https://discourse.julialang.org/t/change-the-number-of-particles-in-the-pf-dynamically/100195>\
**Category:** Statistics\
**Tags:** question, jump, statistics, machine-learning\
**Created:** [June 11, 2023, 5:55pm UTC](https://discourse.julialang.org/t/change-the-number-of-particles-in-the-pf-dynamically/100195 "2023-06-11T17:55:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josemanuel22](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josemanuel22/32/20668_2.png) [@josemanuel22](https://discourse.julialang.org/u/josemanuel22)\
**Post date:** [June 11, 2023, 5:55pm UTC](https://discourse.julialang.org/t/change-the-number-of-particles-in-the-pf-dynamically/100195/1 "2023-06-11T17:55:29Z")

</div>

I am trying to create a particle filter method where the number of particles is adaptive, meaning it changes dynamically depending on whether the method is converging or not. I want to take inspiration from the repository [GitHub - JuliaPOMDP/ParticleFilters.jl: Simple particle filter implementation in Julia - works with POMDPs.jl models or others.](https://github.com/JuliaPOMDP/ParticleFilters.jl), but I don’t quite understand how it works or where the particles used by the `BasicParticleFilter` are set. I understand that it is initialized when the `BasicParticleFilter` is declared, but I don’t fully understand where it is stored afterwards or when it is used. For example, what is the purpose of `_particle_memory` and `_weight_memory`? Which attribute of which method should I change for the `update` method to automatically adjust the number of particles it generates?
