pyANOVAapprox 0.1.2__tar.gz → 0.2.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 (30) hide show
  1. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/.github/workflows/ci.yml +1 -1
  2. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/PKG-INFO +1 -1
  3. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/pyproject.toml +1 -1
  4. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/simpleTest/examplePeriodic.py +23 -13
  5. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/approx.py +9 -6
  6. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/cheb_fista.py +1 -1
  7. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/cheb_lsqr.py +1 -1
  8. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/per_fista.py +1 -1
  9. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/per_lsqr.py +1 -1
  10. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/.github/workflows/documentation.yml +0 -0
  11. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/.github/workflows/format.yml +0 -0
  12. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/.github/workflows/release.yml +0 -0
  13. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/.gitignore +0 -0
  14. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/LICENSE +0 -0
  15. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/README.md +0 -0
  16. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/Makefile +0 -0
  17. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/source/Analysis.rst +0 -0
  18. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/source/Approximation.rst +0 -0
  19. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/source/Errors.rst +0 -0
  20. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/source/conf.py +0 -0
  21. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/docs/source/index.rst +0 -0
  22. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/__init__.py +0 -0
  23. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/analysis.py +0 -0
  24. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/errors.py +0 -0
  25. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/fista.py +0 -0
  26. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/src/pyANOVAapprox/trafos.py +0 -0
  27. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/TestFunctionCheb.py +0 -0
  28. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/TestFunctionPeriodic.py +0 -0
  29. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/run_tests.py +0 -0
  30. {pyanovaapprox-0.1.2 → pyanovaapprox-0.2.0}/tests/wav_lsqr.py +0 -0
@@ -10,7 +10,7 @@ jobs:
10
10
  test:
11
11
  strategy:
12
12
  matrix:
13
- python-version: ['3.12'] # Specify the Python versions you want to test against
13
+ python-version: ['3.11', '3.12'] # Specify the Python versions you want to test against
14
14
  os: [ubuntu-latest, windows-latest]
15
15
  name: Python ${{ matrix.python-version }} - ${{ matrix.os }}
16
16
  runs-on: ${{ matrix.os }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyANOVAapprox
3
- Version: 0.1.2
3
+ Version: 0.2.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.1.2"
7
+ version = "0.2.0"
8
8
  authors = [
9
9
  { name="Felix Wirth", email="fwi012001@gmail.com" },
10
10
  ]
@@ -181,19 +181,29 @@ print("mse = " + str(mse_min))
181
181
  # y_approx = a.evaluate(lam=λ_min) # evaluate the approximation at the training points for the regularisation λ_min
182
182
  # y_approx = a.evaluate(X=X_test, lam=λ_min) # evaluate the approximation at the points X_test for the regularisation λ_min
183
183
 
184
- # In the following we plot the real and the approximated anova term for the subset u=[4]
184
+ # In the following we plot the real and the approximated anova term for the subset u=[3]
185
185
 
186
- y_eval_anova = a.evaluateANOVAterms(X=X_test, lam=λ_min)
186
+ y_eval_anova = a.evaluateANOVAterms(X=X_test, lam=λ_min) # evaluate all of the ANOVA terms
187
+ pos = a.U.index((3,)) # find the index for the subset u=[3]
188
+ y_eval_anova_3 = y_eval_anova.T[pos]
187
189
 
188
- # y_eval_anova = ANOVAapprox.evaluateANOVAterms(a, X_test, λ_min) # evaluate all of the ANOVA terms
189
- # pos = findfirst(==([4]), a.U) # find the index for the subset u=[4]
190
- # y_eval_anova_4 = y_eval_anova[:,pos]
190
+ perm = np.argsort(X_test.T[3])
191
+ X_plot = X_test.T[3][perm]
192
+ y_eval_anova_3_plot = np.real(y_eval_anova_3[perm])
193
+ y_anova_3_plot = -np.exp(np.sin(2*np.pi*X_plot))+1.26607
191
194
 
192
- # perm = sortperm(X_test[4,:])
193
- # X_plot = X_test[4,perm]
194
- # y_eval_anova_4_plot = real.(y_eval_anova_4[perm])
195
- # y_anova_4_plot = -exp.(sin.(2 .* pi .* X_plot)) .+ 1.26607
196
-
197
- # p3 = Plots.plot(X_plot,[y_eval_anova_4_plot,y_anova_4_plot], reuse = false, title = "Approximation of the ANOVA term 4", labels = ["approximation" "ANOVA term"])
198
-
199
- # display(p1); display(p2); p3
195
+ plt.figure()
196
+ plt.plot(
197
+ X_plot,
198
+ y_eval_anova_3_plot,
199
+ label="approximation"
200
+ )
201
+ plt.plot(
202
+ X_plot,
203
+ y_anova_3_plot,
204
+ label="ANOVA term" # ... "ANOVA term"]
205
+ )
206
+ plt.title("Approximation of the ANOVA term 4") # title = "..."
207
+ plt.legend() # Zeigt die Labels/Legende an
208
+ plt.grid(True, linestyle='--', alpha=0.7)
209
+ plt.show()
@@ -50,7 +50,7 @@ def get_orderDependentBW(U, N):
50
50
  else:
51
51
  N_bw[i] = N[len(U[i]) - 1]
52
52
 
53
- return np.array(N_bw, "int32")
53
+ return N_bw
54
54
 
55
55
 
56
56
  ### approx:
@@ -78,7 +78,7 @@ class approx:
78
78
  X,
79
79
  y,
80
80
  U=None,
81
- N=np.array([]),
81
+ N=None,
82
82
  basis="cos",
83
83
  classification=False,
84
84
  basis_vect=[],
@@ -86,7 +86,7 @@ class approx:
86
86
  ds=None,
87
87
  ):
88
88
 
89
- if len(N) == 0:
89
+ if (N == None or len(N) == 0):
90
90
  ValueError("please define N")
91
91
 
92
92
  if (
@@ -95,7 +95,7 @@ class approx:
95
95
  U = get_superposition_set(X.shape[1], ds)
96
96
 
97
97
  if (
98
- N.ndim == 1
98
+ not isinstance(N[0], list)
99
99
  ): # setting N #approx( X::Matrix{Float64}, y::Union{Vector{ComplexF64},Vector{Float64}}, U::Vector{Vector{Int}}, N::Vector{Int}, basis::String = "cos"; classification::Bool = false, basis_vect::Vector{String} = Vector{String}([]), fastmult::Bool = classification ? true : false,)
100
100
  ds = max(len(u) for u in U)
101
101
 
@@ -111,11 +111,14 @@ class approx:
111
111
  for i in range(len(U)):
112
112
  u = U[i]
113
113
  if len(u) == 0:
114
- bws[i] = np.array([0] * len(u), "int32") # passt das so?
114
+ bws[i] = np.array([0] * len(u), np.int32)
115
115
  else:
116
- bws[i] = np.array([bw[i]] * len(u), "int32")
116
+ bws[i] = np.array([bw[i]] * len(u), np.int32)
117
117
 
118
118
  N = bws
119
+
120
+ else:
121
+ N = [np.array(u, dtype = np.int32) for u in N]
119
122
 
120
123
  if basis_vect is None:
121
124
  basis_vect = []
@@ -14,7 +14,7 @@ d = 8
14
14
  ds = 2
15
15
  M = 1000 # eigentlich 10000
16
16
  max_iter = 50
17
- bw = np.array([20, 4], "int32")
17
+ bw = [20, 4]
18
18
  lambdas = np.array([0.0, 1.0])
19
19
 
20
20
  (X, y) = TestFunctionCheb.generateData(M)
@@ -14,7 +14,7 @@ d = 8
14
14
  ds = 2
15
15
  M = 1000 # eigentlich 10000
16
16
  max_iter = 50
17
- bw = np.array([20, 4], "int32")
17
+ bw = [20, 4]
18
18
  lambdas = np.array([0.0, 1.0])
19
19
 
20
20
  (X, y) = TestFunctionCheb.generateData(M)
@@ -14,7 +14,7 @@ d = 6
14
14
  ds = 2
15
15
  M = 10000
16
16
  max_iter = 50
17
- bw = np.array([100, 10], "int32")
17
+ bw = [100, 10]
18
18
  lambdas = np.array([0.0, 1.0])
19
19
 
20
20
  rng = np.random.default_rng()
@@ -16,7 +16,7 @@ d = 6
16
16
  ds = 2
17
17
  M = 10000 # should be 10000
18
18
  max_iter = 50
19
- bw = np.array([100, 10], "int32")
19
+ bw = [100, 10]
20
20
  lambdas = np.array([0.0, 1.0])
21
21
 
22
22
  rng = np.random.default_rng()
File without changes
File without changes
File without changes