pyANOVAapprox 0.2.2__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/PKG-INFO +1 -1
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/pyproject.toml +1 -1
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleWavelet.py +1 -1
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/__init__.py +0 -20
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/approx.py +0 -2
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/errors.py +55 -20
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/fista.py +0 -2
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/ci.yml +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/documentation.yml +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/format.yml +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/release.yml +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.gitignore +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/LICENSE +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/README.md +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/Makefile +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Analysis.rst +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Approximation.rst +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Errors.rst +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/conf.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/index.rst +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleCheb.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleClassification.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleNonPeriodic.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/examplePeriodic.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/analysis.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/trafos.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/TestFunctionCheb.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/TestFunctionPeriodic.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/cheb_fista.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/cheb_lsqr.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/per_fista.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/per_lsqr.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/run_tests.py +0 -0
- {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/wav_lsqr.py +0 -0
|
@@ -84,7 +84,7 @@ print("Total number of used parameters = " + str(len(anova_model.fc[lambdas[0]].
|
|
|
84
84
|
gsis = ANOVAapprox.get_GSI(
|
|
85
85
|
anova_model, 0.0
|
|
86
86
|
) # calculates indices for importance of terms (gsis is vector, with indices belonging to terms in anova_model.U)
|
|
87
|
-
|
|
87
|
+
gsis_as_dict = ANOVAapprox.get_GSI(anova_model, 0.0, dict=true)
|
|
88
88
|
|
|
89
89
|
y_min_calc = 10 ** (np.min(np.log10(gsis)) - 0.5)
|
|
90
90
|
label = list(anova_model.U[1:])
|
|
@@ -10,26 +10,6 @@ from scipy.special import erf
|
|
|
10
10
|
# from sklearn.metrics import roc_auc_score
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def get_superposition_set(d, ds): # TODO: Später funktion aut GT verwenden
|
|
14
|
-
"""
|
|
15
|
-
get_superposition_set( d::Int, ds::Int )::Vector{Vector{Int}}
|
|
16
|
-
|
|
17
|
-
This function returns ``U^{(d,ds)} = \{ \pmb u \subset \{1,2,\dots,d\} : |\pmb u| \leq ds \}``.
|
|
18
|
-
"""
|
|
19
|
-
nset = [[j] for j in range(d)]
|
|
20
|
-
returnset = [[]] + nset
|
|
21
|
-
for i in range(ds - 1):
|
|
22
|
-
nextnset = []
|
|
23
|
-
for s in nset:
|
|
24
|
-
for j in range(d):
|
|
25
|
-
if s[-1] < j:
|
|
26
|
-
nextnset.append(s + [j])
|
|
27
|
-
returnset = returnset + nextnset
|
|
28
|
-
nset = nextnset
|
|
29
|
-
|
|
30
|
-
return [tuple(item) for item in returnset]
|
|
31
|
-
|
|
32
|
-
|
|
33
13
|
def bisection(l, r, fun, maxiter=1000):
|
|
34
14
|
lval = fun(l)
|
|
35
15
|
rval = fun(r)
|
|
@@ -156,6 +156,43 @@ def _acc(a, lam, X, y): # helpfunction for get_acc
|
|
|
156
156
|
return np.sum(np.sign(y_eval) == y) / len(y) * 100.0
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
def auc_score(y_true, y_pred_proba):
|
|
160
|
+
combined_data = sorted(zip(y_pred_proba, y_true), key=lambda x: x[0], reverse=True)
|
|
161
|
+
|
|
162
|
+
P = sum(y_true)
|
|
163
|
+
N = len(y_true) - P
|
|
164
|
+
|
|
165
|
+
tp, fp = 0, 0
|
|
166
|
+
tpr, fpr = 0, 0
|
|
167
|
+
auc = 0.0
|
|
168
|
+
|
|
169
|
+
for i in range(len(combined_data)):
|
|
170
|
+
score, label = combined_data[i]
|
|
171
|
+
|
|
172
|
+
current_tp = 0
|
|
173
|
+
current_fp = 0
|
|
174
|
+
j = i
|
|
175
|
+
while j < len(combined_data) and combined_data[j][0] == score:
|
|
176
|
+
if combined_data[j][1] == 1:
|
|
177
|
+
current_tp += 1
|
|
178
|
+
else:
|
|
179
|
+
current_fp += 1
|
|
180
|
+
j += 1
|
|
181
|
+
|
|
182
|
+
i = j - 1
|
|
183
|
+
|
|
184
|
+
tp += current_tp
|
|
185
|
+
fp += current_fp
|
|
186
|
+
|
|
187
|
+
new_tpr = tp / P
|
|
188
|
+
new_fpr = fp / N
|
|
189
|
+
|
|
190
|
+
auc += (new_fpr - fpr) * (tpr + new_tpr) * 0.5
|
|
191
|
+
|
|
192
|
+
tpr, fpr = new_tpr, new_fpr
|
|
193
|
+
return auc
|
|
194
|
+
|
|
195
|
+
|
|
159
196
|
def get_acc(a, X=None, y=None, lam=None):
|
|
160
197
|
|
|
161
198
|
if lam is not None:
|
|
@@ -164,26 +201,24 @@ def get_acc(a, X=None, y=None, lam=None):
|
|
|
164
201
|
return {l: _acc(a, l, X, y) for l in list(a.fc)}
|
|
165
202
|
|
|
166
203
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
def get_auc(
|
|
185
|
-
a, X=None, y=None, lam=None
|
|
186
|
-
): # gab einen Error in julia und in Python, als ich es mit komplexen werten getestet habe...
|
|
204
|
+
def _auc(a, lam, X, y):
|
|
205
|
+
if y is None:
|
|
206
|
+
y = a.y
|
|
207
|
+
|
|
208
|
+
if X is not None:
|
|
209
|
+
y_eval = a.evaluate(lam, X)
|
|
210
|
+
else:
|
|
211
|
+
y_eval = a.evaluate(lam)
|
|
212
|
+
|
|
213
|
+
y_sc = (y_eval - np.min(y_eval)) / (np.max(y_eval) - np.min(y_eval))
|
|
214
|
+
y = np.where(y == -1.0, 0, y)
|
|
215
|
+
y = np.where(y == 1.0, 1, y)
|
|
216
|
+
y_int = y.astype(np.int64)
|
|
217
|
+
|
|
218
|
+
return auc_score(y_int, y_sc)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def get_auc(a, X=None, y=None, lam=None):
|
|
187
222
|
|
|
188
223
|
if lam is not None:
|
|
189
224
|
return _auc(a, lam, X, y)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|