Skip to content

🐛 Support binary scaling #174

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

Merged
merged 7 commits into from
May 18, 2025
Merged

🐛 Support binary scaling #174

merged 7 commits into from
May 18, 2025

Conversation

o-laurent
Copy link
Contributor

@o-laurent o-laurent commented May 15, 2025

Closes #165.

I had some difficulties so we may squash and merge @alafage.

@o-laurent o-laurent requested a review from Copilot May 15, 2025 13:12
@o-laurent o-laurent self-assigned this May 15, 2025
@o-laurent o-laurent added bug Something isn't working enhancement New feature or request labels May 15, 2025
@o-laurent o-laurent requested a review from alafage May 15, 2025 13:12
@o-laurent o-laurent changed the base branch from main to dev May 15, 2025 13:12
Copilot

This comment was marked as off-topic.

@o-laurent o-laurent requested a review from Copilot May 15, 2025 13:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for binary scaling by adding a new parameter (eps) for numerical stability and updates related error messages and function signatures across multiple calibration scaler implementations.

  • Introduces the eps parameter (default 1e-8) to vector, temperature, and matrix scalers.
  • Updates constructor calls, documentation, and error messages to reflect the addition of eps.
  • Adds abstract method decorators in the base scaler class to standardize API behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
torch_uncertainty/post_processing/calibration/vector_scaler.py Adds eps parameter to the constructor and passes it to the parent class.
torch_uncertainty/post_processing/calibration/temperature_scaler.py Adds eps parameter and updates the super call in the constructor.
torch_uncertainty/post_processing/calibration/scaler.py Adds eps parameter validation, updates labels conversion, and improves error messages.
torch_uncertainty/post_processing/calibration/matrix_scaler.py Adds eps parameter and passes it to the parent class; minor type annotation anomaly.
Comments suppressed due to low confidence (1)

torch_uncertainty/post_processing/calibration/matrix_scaler.py:19

  • The type annotation for the 'device' parameter appears ambiguous due to the bare identifier 'device'. Consider using 'torch.device' to maintain consistency with the other scaler files.
device: Literal["cpu", "cuda"] | device | None = None,

Copy link
Contributor

@alafage alafage left a comment

Choose a reason for hiding this comment

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

Looks great @o-laurent !

@o-laurent o-laurent merged commit 58e742a into dev May 18, 2025
1 check passed
@o-laurent o-laurent deleted the binary_scaling branch May 18, 2025 09:19
@o-laurent o-laurent mentioned this pull request May 18, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Fix TemperatureScaler for binary problems
2 participants