pyANOVAapprox 0.2.0__tar.gz → 0.2.1__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.2.0 → pyanovaapprox-0.2.1}/PKG-INFO +1 -1
  2. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/pyproject.toml +1 -1
  3. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/simpleTest/examplePeriodic.py +25 -30
  4. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/approx.py +5 -5
  5. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/.github/workflows/ci.yml +0 -0
  6. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/.github/workflows/documentation.yml +0 -0
  7. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/.github/workflows/format.yml +0 -0
  8. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/.github/workflows/release.yml +0 -0
  9. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/.gitignore +0 -0
  10. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/LICENSE +0 -0
  11. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/README.md +0 -0
  12. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/Makefile +0 -0
  13. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/source/Analysis.rst +0 -0
  14. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/source/Approximation.rst +0 -0
  15. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/source/Errors.rst +0 -0
  16. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/source/conf.py +0 -0
  17. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/docs/source/index.rst +0 -0
  18. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/__init__.py +0 -0
  19. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/analysis.py +0 -0
  20. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/errors.py +0 -0
  21. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/fista.py +0 -0
  22. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/src/pyANOVAapprox/trafos.py +0 -0
  23. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/TestFunctionCheb.py +0 -0
  24. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/TestFunctionPeriodic.py +0 -0
  25. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/cheb_fista.py +0 -0
  26. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/cheb_lsqr.py +0 -0
  27. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/per_fista.py +0 -0
  28. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/per_lsqr.py +0 -0
  29. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/run_tests.py +0 -0
  30. {pyanovaapprox-0.2.0 → pyanovaapprox-0.2.1}/tests/wav_lsqr.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyANOVAapprox
3
- Version: 0.2.0
3
+ Version: 0.2.1
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.0"
7
+ version = "0.2.1"
8
8
  authors = [
9
9
  { name="Felix Wirth", email="fwi012001@gmail.com" },
10
10
  ]
@@ -39,27 +39,28 @@ num = np.sum([math.comb(6, k) for k in np.arange(1, 2 + 1)]) # number of used s
39
39
  b = M / (
40
40
  math.log10(M) * num
41
41
  ) # number for the number of frequencies if we use logarithmic oversampling and distribute it evenly to all subsets
42
- bw = np.array(
43
- [math.floor(b / 2) * 2, math.floor(math.sqrt(b) / 2) * 2]
44
- ) # bandwidths (use even numbers)
42
+ bw = [
43
+ math.floor(b / 2) * 2,
44
+ math.floor(math.sqrt(b) / 2) * 2,
45
+ ] # bandwidths (use even numbers)
45
46
  # Use all subsets up to ds and use bw[1] many frequences in the the subsets with one element, b[2]^2 many for subsets with two elements and so on
46
47
  #
47
48
  ########### Variant 2:
48
49
  # used subsets:
49
- # U = [Int[], [1], [2], [3], [4], [5], [6],
50
- # [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 3], [2, 4], [2, 5], [2, 6], [3, 4], [3, 5], [3, 6], [4, 5], [4, 6], [5, 6]]
50
+ # U = [(), (0,), (1,), (2,), (3,), (4,), (5,),
51
+ # (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5)]
51
52
  # Bandwidths for these subsets:
52
- # N = [[0] , 100, 100, 100, 100, 100, 100,
53
- # 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
53
+ # N = [0 , 100, 100, 100, 100, 100, 100,
54
+ # 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
54
55
  # Use the subsets U with the bandwiths N. The bandwith N[i] corresponds to the subset U[i]. For subsets with more then one direction is the same bandwidth in all directions used
55
56
  #
56
57
  ########### Variant 3:
57
58
  # used subsets:
58
- # U = [Int[], [1], [2], [3], [4], [5], [6],
59
- # [ 1, 2],[ 1, 3],[ 1, 4],[ 1, 5],[ 1, 6],[ 2, 3],[ 2, 4],[ 2, 5],[ 2, 6],[ 3, 4],[ 3, 5],[ 3, 6],[ 4, 5],[ 4, 6],[ 5, 6]]
59
+ # U = [(), (0,), (1,), (2,), (3,), (4,), (5,),
60
+ # (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5)]
60
61
  # Bandwidths for these subsets:
61
- # N = [Int[], [100], [100], [100], [100], [100], [100],
62
- # [10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10],[10,10]]
62
+ # N = [(), (100,), (100,), (100,), (100,), (100,), (100,),
63
+ # (10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,),(10,10,)]
63
64
  # Use the subsets U with the bandwiths N. The bandwith N[i] corresponds to the subset U[i]. The bandwidth N[i][j] corresponds to the direction U[i][j]
64
65
 
65
66
  lambdas = np.array([0.0, 1.0]) # used regularisation parameters λ
@@ -155,9 +156,9 @@ print(
155
156
  Umask = np.append(np.array([True]), gsis > 1e-2)
156
157
  U = [ads.U[i] for i in np.arange(0, len(Umask))[Umask]] # get important subsets
157
158
  bws = M / (math.log10(M) * (len(U) - 1)) # calculate frequencies per subset
158
- N = np.array(
159
- [math.floor(bws ** (1 / max(1, len(u))) / 2) * 2 for u in U]
160
- ) # distribute the frequencies evenly and make them even
159
+ N = [
160
+ math.floor(bws ** (1 / max(1, len(u))) / 2) * 2 for u in U
161
+ ] # distribute the frequencies evenly and make them even
161
162
  N[0] = 0
162
163
 
163
164
  a = ANOVAapprox.approx(
@@ -183,27 +184,21 @@ print("mse = " + str(mse_min))
183
184
 
184
185
  # In the following we plot the real and the approximated anova term for the subset u=[3]
185
186
 
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]
187
+ y_eval_anova = a.evaluateANOVAterms(
188
+ X=X_test, lam=λ_min
189
+ ) # evaluate all of the ANOVA terms
190
+ pos = a.U.index((3,)) # find the index for the subset u=[3]
188
191
  y_eval_anova_3 = y_eval_anova.T[pos]
189
192
 
190
193
  perm = np.argsort(X_test.T[3])
191
194
  X_plot = X_test.T[3][perm]
192
195
  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
196
+ y_anova_3_plot = -np.exp(np.sin(2 * np.pi * X_plot)) + 1.26607
194
197
 
195
198
  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)
199
+ plt.plot(X_plot, y_eval_anova_3_plot, label="approximation")
200
+ plt.plot(X_plot, y_anova_3_plot, label="ANOVA term") # ... "ANOVA term"]
201
+ plt.title("Approximation of the ANOVA term 4") # title = "..."
202
+ plt.legend() # Zeigt die Labels/Legende an
203
+ plt.grid(True, linestyle="--", alpha=0.7)
209
204
  plt.show()
@@ -86,7 +86,7 @@ class approx:
86
86
  ds=None,
87
87
  ):
88
88
 
89
- if (N == None or len(N) == 0):
89
+ if N == None or len(N) == 0:
90
90
  ValueError("please define N")
91
91
 
92
92
  if (
@@ -94,8 +94,8 @@ class approx:
94
94
  ): # setting U #approx(X::Matrix{Float64}, y::Union{Vector{ComplexF64},Vector{Float64}}, ds::Int, N::Vector{Int}, basis::String = "cos"; classification::Bool = false, basis_vect::Vector{String} = Vector{String}([]), fastmult::Bool = classification ? true : false,)
95
95
  U = get_superposition_set(X.shape[1], ds)
96
96
 
97
- if (
98
- not isinstance(N[0], list)
97
+ if not isinstance(
98
+ N[0], tuple
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
 
@@ -116,9 +116,9 @@ class approx:
116
116
  bws[i] = np.array([bw[i]] * len(u), np.int32)
117
117
 
118
118
  N = bws
119
-
119
+
120
120
  else:
121
- N = [np.array(u, dtype = np.int32) for u in N]
121
+ N = [np.array(u, dtype=np.int32) for u in N]
122
122
 
123
123
  if basis_vect is None:
124
124
  basis_vect = []
File without changes
File without changes
File without changes