Skip to content

Commit

Permalink
fix: numpy float deprecated alias #4
Browse files Browse the repository at this point in the history
  • Loading branch information
francescopisu committed Sep 15, 2023
1 parent f83e647 commit 3e71866
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/modelsight/curves/_delong.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ def compute_midrank(x):
J = np.argsort(x)
Z = x[J]
N = len(x)
T = np.zeros(N, dtype=np.float)
T = np.zeros(N, dtype=np.float64)
i = 0
while i < N:
j = i
while j < N and Z[j] == Z[i]:
j += 1
T[i:j] = 0.5*(i + j - 1)
i = j
T2 = np.empty(N, dtype=np.float)
T2 = np.empty(N, dtype=np.float64)
# Note(kazeevn) +1 is due to Python using 0-based indexing
# instead of 1-based in the AUC formula in the paper
T2[J] = T + 1
Expand Down Expand Up @@ -58,9 +58,9 @@ def fastDeLong(predictions_sorted_transposed, label_1_count):
negative_examples = predictions_sorted_transposed[:, m:]
k = predictions_sorted_transposed.shape[0]

tx = np.empty([k, m], dtype=np.float)
ty = np.empty([k, n], dtype=np.float)
tz = np.empty([k, m + n], dtype=np.float)
tx = np.empty([k, m], dtype=np.float64)
ty = np.empty([k, n], dtype=np.float64)
tz = np.empty([k, m + n], dtype=np.float64)
for r in range(k):
tx[r, :] = compute_midrank(positive_examples[r, :])
ty[r, :] = compute_midrank(negative_examples[r, :])
Expand Down
2 changes: 0 additions & 2 deletions src/modelsight/curves/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ def roc_single_comparison(cv_preds, fst_algo, snd_algo):
fst_algo_probas = cv_preds[fst_algo].probas_val_conc
snd_algo_probas = cv_preds[snd_algo].probas_val_conc

print("A"*100)
print(fst_algo_probas.shape, snd_algo_probas.shape)
P = delong_roc_test(ground_truths, fst_algo_probas, snd_algo_probas)
cmp_key = f"{fst_algo}_{snd_algo}"
return {cmp_key: (fst_algo, snd_algo, P)}
Expand Down

0 comments on commit 3e71866

Please sign in to comment.