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

Sample entropy is negative with unsigned numbers #334

Open
refi64 opened this issue Oct 21, 2023 · 0 comments
Open

Sample entropy is negative with unsigned numbers #334

refi64 opened this issue Oct 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@refi64
Copy link

refi64 commented Oct 21, 2023

Describe the bug
If I pass unsigned numbers to complexity_normalized(SampleEntropy), the resulting entropy is negative.

Minimal Working Example

A few examples:

julia> entropy_sample(rand(UInt32,6000))
-0.0020435533500534255

julia> entropy_sample(rand(UInt32,6000), normalize = false)
-0.02297010297324151

vs when using signed ints:

julia> entropy_sample(rand(Int32,6000))
0.022439025318529444

julia> entropy_sample(rand(Int32,6000), normalize = false)
0.3244738161894723

I'm not really an expert here so I'm not sure if the non-normalized entropy can be negative, but I'm quite sure the normalized one shouldn't be negative given that it should be in [0,1]?

Package versions

  [ab4b797d] ComplexityMeasures v2.8.0
@Datseris Datseris added the bug Something isn't working label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants