Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use of entropy #385

Closed
remco-r opened this issue Jul 7, 2021 · 2 comments
Closed

use of entropy #385

remco-r opened this issue Jul 7, 2021 · 2 comments

Comments

@remco-r
Copy link
Contributor

remco-r commented Jul 7, 2021

The status topic outputs entropy.

Calculation happens like this:


 float getEntropy()
  {
    float sum = 0.0f;
    for (auto& particle : *pf_)
    {
      sum += particle.probability_;
    }

    float entropy = 0.0f;
    for (auto& particle : *pf_)
    {
      if (particle.probability_ / sum > 0.0)
        entropy += particle.probability_ / sum * std::log(particle.probability_ / sum);
    }

    return -entropy;
  }

sum does not have to be calculated. Its always 1.0, because particle.probability_ = 1/particles.size().
Then, entropy is always the same number if the particle size does not change.
Particle size only changes when doing global localization. This is the only moment you can see the entropy going down.

What use is this metric if its not used in the code, and there is already particle_size present in the status output?

@remco-r
Copy link
Contributor Author

remco-r commented Jul 7, 2021

i filed this too soon. probability is initialized as 1/particle_size and then in the measure step updated with likelihood. However still the sum will be near 1.0 and the entropy will not change, at least not in the printable digits.

@remco-r remco-r closed this as completed Jul 7, 2021
@at-wat
Copy link
Owner

at-wat commented Jul 7, 2021

FYI @DaikiMaekawa
(#265)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants