Skip to content

Make composite_proximity independent of argument order - #261

Merged
pradeeban merged 1 commit into
KathiraveluLab:mainfrom
madhavzanwar:fix/composite-proximity-symmetric-geo
Oct 18, 2026
Merged

pradeeban merged 1 commit into
KathiraveluLab:mainfrom
madhavzanwar:fix/composite-proximity-symmetric-geo

Conversation

@madhavzanwar

Copy link
Copy Markdown
Contributor

Fixes #257

composite_proximity(a, b) and composite_proximity(b, a) could differ, because only the first place's geo_proximity was read. In the example from the issue the two orders gave 0.97 and 0.73.

Change
In dreams_app/core/extra/proximity_calculator.py, geo_proximity is now read from both places. If both have one, their mean is used. If only one has it, that value is used. A short note in the docstring says so. Behaviour only changes when the two places carry different geo_proximity values; every other case returns what it did before.

Tests
Three new tests in tests/test_proximity_calculator.py: the score is the same in either order, the mean is used when both values are present, and a single value counts whichever place carries it. All three failed before the change.

Testing

  • tests/test_proximity_calculator.py: 34 passed.
  • Full suite: 352 passed, 1 skipped. I excluded tests/test_places365_classifier.py, which needs torchvision, in my environment.

I picked the mean because it's the simplest symmetric choice. If you prefer the minimum or a pair-level value, it's a one-line change.

AI assistance was used for this change; the tests were run before submitting.

Only place1's geo_proximity was read, so composite_proximity(a, b) and
composite_proximity(b, a) could differ. Read it from both places and use
their mean, and add tests for symmetry and for the mean.
Copilot AI balanced review requested due to automatic review settings October 17, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@pradeeban
pradeeban merged commit 0b46363 into KathiraveluLab:main Oct 18, 2026
1 of 3 checks passed
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

Successfully merging this pull request may close these issues.

composite_proximity is not symmetric: only the first place’s geo_proximity is used

3 participants