Skip to content

Commit 268204d

Browse files
authored
Merge pull request #8 from NFFT/python-code-format-patches
Fixes by format action
2 parents f1bd999 + 47c70d9 commit 268204d

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

simpleTest/exampleWavelet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def TestFunction(x): # this function is of the form f_0 + f_1 + f_2 + f_3 + f_4
8484
gsis = ANOVAapprox.get_GSI(
8585
anova_model, 0.0
8686
) # calculates indices for importance of terms (gsis is vector, with indices belonging to terms in anova_model.U)
87-
gsis_as_dict = ANOVAapprox.get_GSI(anova_model,0.0,dict=true)
87+
gsis_as_dict = ANOVAapprox.get_GSI(anova_model, 0.0, dict=true)
8888

8989
y_min_calc = 10 ** (np.min(np.log10(gsis)) - 0.5)
9090
label = list(anova_model.U[1:])

src/pyANOVAapprox/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# from sklearn.metrics import roc_auc_score
1111

12+
1213
def bisection(l, r, fun, maxiter=1000):
1314
lval = fun(l)
1415
rval = fun(r)

src/pyANOVAapprox/errors.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,20 @@ def _acc(a, lam, X, y): # helpfunction for get_acc
155155

156156
return np.sum(np.sign(y_eval) == y) / len(y) * 100.0
157157

158+
158159
def auc_score(y_true, y_pred_proba):
159160
combined_data = sorted(zip(y_pred_proba, y_true), key=lambda x: x[0], reverse=True)
160-
161+
161162
P = sum(y_true)
162163
N = len(y_true) - P
163-
164+
164165
tp, fp = 0, 0
165166
tpr, fpr = 0, 0
166167
auc = 0.0
167168

168169
for i in range(len(combined_data)):
169170
score, label = combined_data[i]
170-
171+
171172
current_tp = 0
172173
current_fp = 0
173174
j = i
@@ -177,12 +178,12 @@ def auc_score(y_true, y_pred_proba):
177178
else:
178179
current_fp += 1
179180
j += 1
180-
181+
181182
i = j - 1
182183

183184
tp += current_tp
184185
fp += current_fp
185-
186+
186187
new_tpr = tp / P
187188
new_fpr = fp / N
188189

@@ -191,6 +192,7 @@ def auc_score(y_true, y_pred_proba):
191192
tpr, fpr = new_tpr, new_fpr
192193
return auc
193194

195+
194196
def get_acc(a, X=None, y=None, lam=None):
195197

196198
if lam is not None:
@@ -216,9 +218,7 @@ def _auc(a, lam, X, y):
216218
return auc_score(y_int, y_sc)
217219

218220

219-
def get_auc(
220-
a, X=None, y=None, lam=None
221-
):
221+
def get_auc(a, X=None, y=None, lam=None):
222222

223223
if lam is not None:
224224
return _auc(a, lam, X, y)

0 commit comments

Comments
 (0)