Skip to content

Commit

Permalink
Fixed low contamination issue in RANK
Browse files Browse the repository at this point in the history
  • Loading branch information
KulikDM committed Dec 19, 2024
1 parent b097a2a commit 5d9b340
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ v<0.3.7>, <08/18/2024> -- Fixed muli-peak error in FWFM
v<0.3.7>, <08/18/2024> -- Updated time complexity benchmarks
v<0.3.8>, <11/21/2024> -- Added factor arg to MAD and ZSCORE, contribution by @MalikAly
v<0.3.8>, <12/15/2024> -- Removed matplotlib as core dependency
v<0.3.9>, <12/19/2024> -- Fixed low contamination issue in RANK
5 changes: 4 additions & 1 deletion pythresh/utils/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,13 @@ def _cdf_metric(self, scores, labels):
scores1 = scores1 + np.linspace(1e-30, 2e-30, len(scores1))

scores2 = scores[labels == 1]
if len(scores2) < 2:
return [-1e6, -1e6]

if np.all(scores2 == scores2[0]):
scores2 = scores2 - np.linspace(1e-30, 2e-30, len(scores2))

# Generate KDEs of scores for both classed
# Generate KDEs of scores for both classes
kde1 = stats.gaussian_kde(scores1)
kde2 = stats.gaussian_kde(scores2)

Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pyclustering
https://github.com/KulikDM/pyclustering/archive/Warning-Fix.zip
joblib>=0.14.1
numpy<=1.26.4
numpy
pandas
pyod
ruptures
Expand Down

0 comments on commit 5d9b340

Please sign in to comment.