Skip to content

Commit

Permalink
fix minmax issues (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahmish authored Dec 5, 2024
1 parent 445ff23 commit 6b16d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions orion/primitives/aer.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ def score_anomalies(y: ndarray, ry_hat: ndarray, y_hat: ndarray, fy_hat: ndarray

scores = None
if comb == "mult":
reg_scores = MinMaxScaler([1, 2]).fit_transform(reg_scores.reshape(-1, 1)).flatten()
rec_scores = MinMaxScaler([1, 2]).fit_transform(rec_scores.reshape(-1, 1)).flatten()
feature_range = (1, 2)
reg_scores = MinMaxScaler(feature_range).fit_transform(reg_scores.reshape(-1, 1)).flatten()
rec_scores = MinMaxScaler(feature_range).fit_transform(rec_scores.reshape(-1, 1)).flatten()
scores = np.multiply(reg_scores, rec_scores)

elif comb == "sum":
reg_scores = MinMaxScaler([0, 1]).fit_transform(reg_scores.reshape(-1, 1)).flatten()
rec_scores = MinMaxScaler([0, 1]).fit_transform(rec_scores.reshape(-1, 1)).flatten()
feature_range = (0, 1)
reg_scores = MinMaxScaler(feature_range).fit_transform(reg_scores.reshape(-1, 1)).flatten()
rec_scores = MinMaxScaler(feature_range).fit_transform(rec_scores.reshape(-1, 1)).flatten()
scores = (1 - lambda_rec) * reg_scores + lambda_rec * rec_scores

elif comb == "rec":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
's3fs>=0.2.2,<0.5',
'mlblocks>=0.6.2,<0.7',
'ml-stars>=0.2.1.dev0,<0.4',
'scikit-learn>=0.22.1,<1.2',
'scikit-learn>=0.22.1,<2',
'scipy<1.14',
'tabulate>=0.8.3,<0.9',
'pyts>=0.11,<0.14',
Expand Down

0 comments on commit 6b16d35

Please sign in to comment.