Repository navigation
Compute Katz distances without integer wraparound - #59
Draft
AHMETHAKANBEZIR1 wants to merge 1 commit into
Draft
AHMETHAKANBEZIR1 wants to merge 1 commit into
AHMETHAKANBEZIR1 wants to merge 1 commit into
Conversation
Owner
|
Thank you for your contribution! AntroPy now has guidelines for pull requests, including specific steps for AI-assisted PRs: #61 Before I review this PR, could you please go through those steps and update the PR accordingly? In particular: state the user-impact rating (P1-P3) with a short justification, start the description with a summary in your own words, report the exact AI model used (if any), and run an AI review and post a summary of it as a comment. Thanks! |
AHMETHAKANBEZIR1
marked this pull request as draft
October 24, 2026 12:27
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.
katz_fdcomputes successive and origin-relative distances in the input integer dtype. Falling unsigned steps wrap, narrow signed differences overflow, and the total path length can overflow as well. For example,[1, 5, 2, 8, 3]as uint8 returns about -0.4764 instead of the floating-reference value 3.1376. Boolean inputs also fail during subtraction.Compute ordered integer distance magnitudes using uint64 subtraction, then convert the magnitudes to float64 for the existing Katz formula. This handles the full signed/unsigned 64-bit distance range. Casting samples to float64 first would lose differences between nearby large integers, so the tests explicitly protect that case. The floating-point path and the definition of Katz FD are retained. This changes only Katz; #56 and #57 address different features.
Validation on Windows CPU, Python 3.12.14:
6843920gives 24 failures and 7 passing controls; the patch passes all 31. References calculate distances with Python integers before evaluating the existing formula. Cases include unsigned ADC values, signed/unsigned extrema, close large 64-bit integers, booleans, vectors and both matrix axes, read-only inputs, and bit-identical fractional float controls.-W) passed, including the updated Katz notes.This does not change the mathematical formula's degenerate/infinite cases. Other operating systems, doctests, performance benchmarks and downstream classification/clinical effects were not tested.
AI disclosure: OpenAI Codex autonomously investigated and implemented this patch/tests, wrote the description and ran the reported checks. No independent human pre-submission review has been performed.