Skip to content

Conversation

@michele-milesi
Copy link
Member

Summary

Describe the purpose of the pull request, including:

  • Inconsistent results in anomaly test and generated report
  • Force normalized scores to be aligned with raw scores (in particular the ones close to the anomaly threshold)

Type of Change

Please select the one relevant option below:

  • Bug fix (non-breaking change that solves an issue)

Checklist

Please confirm that the following tasks have been completed:

  • I have tested my changes locally and they work as expected. (Please describe the tests you performed.)
  • I have added unit tests for my changes, or updated existing tests if necessary.
  • I have updated the documentation, if applicable.
  • I have installed pre-commit and run locally for my code changes.

# The reason I have to expand dims and cast the optimal threshold to anomaly_scores dtype is because
# of internal roundings performed differently by numpy and python
# Particularly the normalized_optimal_threshold computed directly using float values might be higher than the
# actual value obtained by the anomaly_scores, as such the computed f1 score might be wrong in the UI!!
Copy link
Contributor

Choose a reason for hiding this comment

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

In the UI 🤯 ?

# For all the items whose prediction changes after normalization, force the normalized score to be
# consistent with the prediction made on the raw score by clipping the score:
# - to 100.0 if the prediction was "anomaly" on the raw score and "good" on the normalized score
# - to 99.0 if the prediction was "good" on the raw score and "anomaly" on the normalized score
Copy link
Contributor

Choose a reason for hiding this comment

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

Non cambia niente, ma se mettessimo 99.99 come default? Giusto per far capire che è un valore particolare

@lorenzomammana lorenzomammana merged commit bf26f4a into main Dec 9, 2025
1 check passed
@lorenzomammana lorenzomammana deleted the fix/inconsistent-anomaly-score branch December 9, 2025 08:45
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.

3 participants