Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sample and approximate entropy subtract template vectors in the original input dtype. Unsigned subtraction wraps and signed subtraction/abs can overflow, so integer sensor signals produce different template-match counts and entropy from their mathematical values. Boolean signals raise on subtraction.
Promote integer inputs before computing template distances. Use float64 when all integer values are within +/-2**52, so their pairwise differences are exact and the normal fixed-width path stays fast. Use Python integer arithmetic outside that range to preserve exact signed differences at int64/uint64 limits; the floating-input path and the existing tolerance calculation are unchanged.
Eleven regression cases cover int8/uint8/int16/int64/uint64 arrays and Series plus booleans. A separate Python-loop oracle counts template matches using arbitrary-precision integer subtraction. All eleven fail before the fix. With the fix, the new tests and entire existing feature-calculation module pass: 96 passed, 3 skipped. Black 22.12.0, isort 5.12.0 (Black profile) and git diff --check pass.
The change is separate from pending PRs1133/1134: those cover energy and time-adjacent differences, whereas these estimators compare all embedded template pairs. No benchmark or performance claim is made. Only 64-bit values outside +/-2**52 take the object-integer path; it favors exact comparisons and may cost more than the fixed-width path.