JuliaDynamics / ComplexityMeasures.jl

Estimators for probabilities, entropies, and other complexity measures derived from data in the context of nonlinear dynamics and complex systems
MIT License
59 stars 14 forks source link

Slightly larger edge lengths ensures bins cover all points #129

Closed kahaaga closed 2 years ago

kahaaga commented 2 years ago

Fixes #128. Increasing bin edge widths by 1*eps() seems to be enough to avoid round-off issues in encode_as_bin.

This seems to work when tested experimentally, but a more robust solution is perhaps desired. Any suggestions are welcome.

codecov[bot] commented 2 years ago

Codecov Report

Merging #129 (b6c0a48) into main (30880cd) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #129   +/-   ##
=======================================
  Coverage   80.59%   80.59%           
=======================================
  Files          32       32           
  Lines         706      706           
=======================================
  Hits          569      569           
  Misses        137      137           
Impacted Files Coverage Δ
...ities_estimators/histograms/rectangular_binning.jl 92.85% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

kahaaga commented 2 years ago

RectangularBinEncoder now takes a keyword argument that controls the size of the extra width added to ensure bin coverage. As discussed in #128 , I test this by explicitly testing the internal function encode_as_bin, which doesn't test an outcome of some method, but at least demonstrates that the problem of extra bins disappears when using a slightly larger extra width.

Are you happy with these tests, @Datseris? If so, feel free to squash and merge.