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.
Files changed (34) hide show
  1. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/PKG-INFO +1 -1
  2. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/pyproject.toml +1 -1
  3. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleWavelet.py +1 -1
  4. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/__init__.py +0 -20
  5. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/approx.py +0 -2
  6. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/errors.py +55 -20
  7. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/fista.py +0 -2
  8. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/ci.yml +0 -0
  9. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/documentation.yml +0 -0
  10. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/format.yml +0 -0
  11. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.github/workflows/release.yml +0 -0
  12. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/.gitignore +0 -0
  13. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/LICENSE +0 -0
  14. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/README.md +0 -0
  15. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/Makefile +0 -0
  16. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Analysis.rst +0 -0
  17. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Approximation.rst +0 -0
  18. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/Errors.rst +0 -0
  19. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/conf.py +0 -0
  20. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/docs/source/index.rst +0 -0
  21. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleCheb.py +0 -0
  22. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleClassification.py +0 -0
  23. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/exampleNonPeriodic.py +0 -0
  24. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/simpleTest/examplePeriodic.py +0 -0
  25. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/analysis.py +0 -0
  26. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/src/pyANOVAapprox/trafos.py +0 -0
  27. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/TestFunctionCheb.py +0 -0
  28. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/TestFunctionPeriodic.py +0 -0
  29. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/cheb_fista.py +0 -0
  30. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/cheb_lsqr.py +0 -0
  31. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/per_fista.py +0 -0
  32. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/per_lsqr.py +0 -0
  33. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/run_tests.py +0 -0
  34. {pyanovaapprox-0.2.2 → pyanovaapprox-1.0.0}/tests/wav_lsqr.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyANOVAapprox
3
- Version: 0.2.2
3
+ Version: 1.0.0
4
4
  Summary: Approximation Package for High-Dimensional Functions
5
5
  Project-URL: Homepage, https://github.com/NFFT/pyGroupedTransforms
6
6
  Author-email: Felix Wirth <fwi012001@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pyANOVAapprox"
7
- version = "0.2.2"
7
+ version = "1.0.0"
8
8
  authors = [
9
9
  { name="Felix Wirth", email="fwi012001@gmail.com" },
10
10
  ]
@@ -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
- # 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)
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)
@@ -1,5 +1,3 @@
1
- # from pyGroupedTransforms.GroupedTransform import * # TODO: Kann wahrscheinlich weg sobald in pyGroupedTransform GreoupedTransform exportiert wird
2
-
3
1
  from pyANOVAapprox import *
4
2
  from pyANOVAapprox.fista import *
5
3
 
@@ -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
- # def _auc(a, lam, X, y): # helpfunction for get_auc #TODO: implement ROC AUC Score
168
- # if y is None:
169
- # y = a.y
170
- #
171
- # if X is not None:
172
- # y_eval = a.evaluate(lam, X)
173
- # else:
174
- # y_eval = a.evaluate(lam)
175
- #
176
- # y_sc = (y_eval - np.min(y_eval)) / (np.max(y_eval) - np.min(y_eval))
177
- # y = np.where(y == -1.0, 0, y)
178
- # y = np.where(y == 1.0, 1, y)
179
- # y_int = y.astype(np.int64)
180
- #
181
- # return roc_auc_score(y_int, y_sc)
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)
@@ -1,5 +1,3 @@
1
- # from pyGroupedTransforms.GroupedCoefficients import * # TODO: Kann wahrscheinlich weg sobald in pyGroupedTransform GreoupedTransform exportiert wird
2
-
3
1
  from pyANOVAapprox import *
4
2
 
5
3
 
File without changes
File without changes
File without changes