surrogates_interface 4.2.0__tar.gz → 4.3.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.
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: surrogates_interface
3
- Version: 4.2.0
3
+ Version: 4.3.1
4
4
  Summary: Interface for surrogate models.
5
- Home-page: https://gitlab.windenergy.dtu.dk/surrogate-models/surrogate-models-interface
6
5
  License: MIT
7
6
  Author: DTU Wind and Energy Systems
8
7
  Maintainer: Riccardo Riva
@@ -16,35 +15,38 @@ Classifier: Programming Language :: Python :: 3.12
16
15
  Provides-Extra: code-style
17
16
  Provides-Extra: docs
18
17
  Provides-Extra: om
18
+ Provides-Extra: sklearn
19
19
  Provides-Extra: smt
20
+ Provides-Extra: spyder
20
21
  Provides-Extra: test
21
22
  Provides-Extra: tf
22
23
  Provides-Extra: torch
23
- Requires-Dist: black (>=24.0.0,<25.0.0) ; extra == "code-style"
24
- Requires-Dist: codespell (>=2.0.0,<3.0.0) ; extra == "code-style"
24
+ Requires-Dist: PyQt6 (>=6.8.1,<7.0.0) ; extra == "spyder"
25
+ Requires-Dist: black (>=25.1.0,<26.0.0) ; extra == "code-style"
26
+ Requires-Dist: codespell (>=2.4.0,<3.0.0) ; extra == "code-style"
25
27
  Requires-Dist: flake8 (>=7.0.0,<8.0.0) ; extra == "code-style"
26
28
  Requires-Dist: h5py (>=3.10.0,<4.0.0)
27
- Requires-Dist: isort (>=5.0.0,<6.0.0) ; extra == "code-style"
28
- Requires-Dist: keras (>=3.0.0,<4.0.0) ; extra == "tf" or extra == "torch"
29
- Requires-Dist: matplotlib (>=3.8.0,<4.0.0) ; extra == "test" or extra == "smt"
30
- Requires-Dist: numpy (>=1.10.0)
29
+ Requires-Dist: isort (>=6.0.0,<7.0.0) ; extra == "code-style"
30
+ Requires-Dist: keras (>=3.0.0,<4.0.0) ; extra == "torch"
31
+ Requires-Dist: matplotlib (>=3.0.0,<4.0.0) ; extra == "smt"
32
+ Requires-Dist: numpy (>=1.10.0,<3.0.0)
31
33
  Requires-Dist: numpydoc (>=1.8.0,<2.0.0) ; extra == "docs"
32
- Requires-Dist: openmdao (>=3.25,<4.0) ; extra == "docs" or extra == "test" or extra == "om"
33
- Requires-Dist: pydata-sphinx-theme ; extra == "docs"
34
- Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "test"
34
+ Requires-Dist: openmdao (>=3.0.0,<4.0.0) ; extra == "om"
35
+ Requires-Dist: pydata-sphinx-theme (>=0.16.1,<1.0.0) ; extra == "docs"
36
+ Requires-Dist: pytest (>=8.3.0,<9.0.0) ; extra == "test"
35
37
  Requires-Dist: pytest-cov (>=6.0.0,<7.0.0) ; extra == "test"
36
- Requires-Dist: scikit-learn (>=1.4.0,<2.0.0) ; extra == "test" or extra == "smt" or extra == "tf" or extra == "torch"
37
- Requires-Dist: smt (>=2.0.1,<3.0.0) ; extra == "test" or extra == "smt"
38
+ Requires-Dist: scikit-learn (>=1.4.0,<2.0.0) ; extra == "sklearn"
39
+ Requires-Dist: smt (>=2.0.0,<3.0.0) ; extra == "smt"
38
40
  Requires-Dist: sphinx (>=8.0.0,<9.0.0) ; extra == "docs"
39
- Requires-Dist: sphinx-copybutton ; extra == "docs"
40
- Requires-Dist: sphinx-sitemap (>=2.0.0,<3.0.0) ; extra == "docs"
41
- Requires-Dist: sphinx_design ; extra == "docs"
42
- Requires-Dist: tensorflow (>=2.10.0,<3.0.0) ; extra == "test" or extra == "tf"
43
- Requires-Dist: tensorflow-intel (>=2.10.0,<3.0.0) ; (sys_platform == "win32") and (extra == "test" or extra == "tf")
44
- Requires-Dist: tensorflow-io-gcs-filesystem (<0.32.0) ; (python_version >= "3.10" and python_version < "3.12" and platform_system == "Windows") and (extra == "test" or extra == "tf")
45
- Requires-Dist: tensorflow-io-gcs-filesystem (>=0.23.1) ; (platform_machine != "arm64" and python_version >= "3.10" and python_version < "3.12" or platform_system != "Darwin" and python_version >= "3.10" and python_version < "3.12") and (extra == "test" or extra == "tf")
46
- Requires-Dist: tomli (>=2.0.1,<3.0.0) ; (python_version < "3.11") and (extra == "test")
47
- Requires-Dist: torch (>=2.0.0,<3.0.0) ; extra == "test" or extra == "torch"
41
+ Requires-Dist: sphinx-copybutton (>=0.5.2,<1.0.0) ; extra == "docs"
42
+ Requires-Dist: sphinx-sitemap (>=2.6.0,<3.0.0) ; extra == "docs"
43
+ Requires-Dist: sphinx_design (>=0.6.1,<1.0.0) ; extra == "docs"
44
+ Requires-Dist: spyder-kernels (>=3.0.0,<3.1.0) ; extra == "spyder"
45
+ Requires-Dist: tensorflow (>=2.10.0,<2.20.0) ; extra == "tf"
46
+ Requires-Dist: tensorflow-io-gcs-filesystem (==0.31.0) ; (python_version < "3.12") and (extra == "tf")
47
+ Requires-Dist: tomli (>=2.0.0,<3.0.0) ; python_version < "3.11"
48
+ Requires-Dist: torch (>=2.0.0,<3.0.0) ; extra == "torch"
49
+ Project-URL: Documentation, https://surrogate-models.pages.windenergy.dtu.dk/surrogate-models-interface
48
50
  Project-URL: Repository, https://gitlab.windenergy.dtu.dk/surrogate-models/surrogate-models-interface
49
51
  Description-Content-Type: text/markdown
50
52
 
@@ -0,0 +1,87 @@
1
+ [project]
2
+ name = "surrogates_interface"
3
+ version = "4.3.1"
4
+ description = "Interface for surrogate models."
5
+ authors = [
6
+ {name = "DTU Wind and Energy Systems"}
7
+ ]
8
+ maintainers = [
9
+ {name = "Riccardo Riva", email = "ricriv@dtu.dk"},
10
+ {name = "Mads Mølgaard Pedersen", email = "mmpe@dtu.dk"}
11
+ ]
12
+ license = { text = "MIT" }
13
+ readme = "README.md"
14
+ requires-python = ">=3.10,<3.13"
15
+
16
+ dependencies = [
17
+ "tomli >=2.0.0, <3.0.0; python_version<'3.11'",
18
+ "numpy >=1.10.0, <3.0.0",
19
+ "h5py >=3.10.0, <4.0.0",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+
24
+ code_style = [
25
+ "black >=25.1.0, <26.0.0",
26
+ "isort >=6.0.0, <7.0.0",
27
+ "flake8 >=7.0.0, <8.0.0",
28
+ "codespell >=2.4.0, <3.0.0",
29
+ ]
30
+
31
+ docs = [
32
+ "sphinx >=8.0.0, <9.0.0",
33
+ "pydata-sphinx-theme >=0.16.1, <1.0.0",
34
+ "numpydoc >=1.8.0, <2.0.0",
35
+ "sphinx-copybutton >=0.5.2, <1.0.0",
36
+ "sphinx-sitemap >=2.6.0, <3.0.0",
37
+ "sphinx_design >=0.6.1, <1.0.0",
38
+ ]
39
+
40
+ om = ["openmdao >=3.0.0, <4.0.0"]
41
+
42
+ smt = [
43
+ "smt >=2.0.0, <3.0.0",
44
+ "matplotlib >=3.0.0, <4.0.0", # Needed by SMT.
45
+ ]
46
+
47
+ sklearn = ["scikit-learn >=1.4.0, <2.0.0"]
48
+
49
+ spyder = [
50
+ "spyder-kernels >=3.0.0, <3.1.0",
51
+ "PyQt6 >=6.8.1, <7.0.0",
52
+ ]
53
+
54
+ tf = [
55
+ "tensorflow >=2.10.0, <2.20.0",
56
+ "tensorflow-io-gcs-filesystem == 0.31.0 ; python_version<'3.12'",
57
+ ]
58
+
59
+ test = [
60
+ "pytest >=8.3.0, <9.0.0",
61
+ "pytest-cov >=6.0.0, <7.0.0",
62
+ # "pytest-xdist >=3.6.1, <4.0.0",
63
+ ]
64
+
65
+ torch = ["torch >=2.0.0,<3.0.0",
66
+ "keras >=3.0.0,<4.0.0",
67
+ ]
68
+
69
+ [project.urls]
70
+ repository = "https://gitlab.windenergy.dtu.dk/surrogate-models/surrogate-models-interface"
71
+ documentation = "https://surrogate-models.pages.windenergy.dtu.dk/surrogate-models-interface"
72
+
73
+ [build-system]
74
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
75
+ build-backend = "poetry.core.masonry.api"
76
+
77
+ [tool.coverage.run]
78
+ omit = ["surrogates_interface/test/*", ]
79
+
80
+ [tool.coverage.report]
81
+ fail_under = 100
82
+
83
+ [tool.isort]
84
+ profile = "black"
85
+
86
+ [tool.codespell]
87
+ ignore-words-list = "coo"
@@ -427,13 +427,12 @@ class SurrogateModel:
427
427
  Predict the complete model output and Jacobian, including all input and output transformations.
428
428
 
429
429
  Let's recall that the predicted output is given by
430
-
430
+
431
431
  .. math::
432
432
  \hat{y} = g_1^{-1}(g_2^{-1}(g_m^{-1}(s(f_n(f_2(f_1(x)))))))
433
-
434
433
  By indicating with :math:`J_h(z)` the Jacobian of :math:`h` evaluated at :math:`z`, we obtain
435
434
  the Jacobian of the predicted output by applying the chain rule
436
-
435
+
437
436
  .. math::
438
437
  J = &J_{g_1^{-1}}(g_2^{-1}(g_m^{-1}(s(f_n(f_2(f_1(x))))))) \\
439
438
  &J_{g_2^{-1}}(g_m^{-1}(s(f_n(f_2(f_1(x)))))) \\
@@ -803,7 +802,7 @@ class TensorFlowModel(SurrogateModel):
803
802
  Output data.
804
803
  """
805
804
  # TODO: Add support also for other arguments of predict, like use_multiprocessing.
806
- y = self.model.predict(x, batch_size=x.shape[0], verbose=0)
805
+ y = self.model(x, training=False).numpy()
807
806
  return y
808
807
 
809
808
  def _predict_model_output_and_jacobian_rev(self, x):
@@ -1,115 +0,0 @@
1
- [tool.poetry]
2
- name = "surrogates_interface"
3
- version = "4.2.0"
4
- description = "Interface for surrogate models."
5
- authors = ["DTU Wind and Energy Systems"]
6
- maintainers = [
7
- "Riccardo Riva <ricriv@dtu.dk>",
8
- "Mads Mølgaard Pedersen <mmpe@dtu.dk>",
9
- ]
10
- license = "MIT"
11
- readme = "README.md"
12
- repository = "https://gitlab.windenergy.dtu.dk/surrogate-models/surrogate-models-interface"
13
-
14
- [tool.poetry.build]
15
- generate-setup-file = false
16
-
17
- [tool.poetry.dependencies]
18
-
19
- python = ">=3.10,<3.13"
20
- numpy = {version=">=1.10.0"}
21
- h5py = {version="^3.10.0"}
22
- black = {version="^24.0.0", optional=true}
23
- flake8 = {version="^7.0.0", optional=true}
24
- isort = {version="^5.0.0", optional=true}
25
- codespell = {version="^2.0.0", optional=true}
26
- pytest = {version="^8.0.0", optional=true}
27
- pytest-cov = {version="^6.0.0", optional=true}
28
- tomli = {version="^2.0.1", python="<3.11", optional=true}
29
- sphinx = {version="^8.0.0", optional=true}
30
- pydata-sphinx-theme = {version="*", optional=true}
31
- sphinx-copybutton = {version="*", optional=true}
32
- sphinx-sitemap = {version="^2.0.0", optional=true}
33
- sphinx_design = {version="*", optional=true}
34
- numpydoc = {version="^1.8.0", optional=true}
35
- matplotlib = {version="^3.8.0", optional=true}
36
- scikit-learn = {version="^1.4.0", optional=true}
37
- # The following configuration for TensorFlow seems to work on Windows and linux, as tested at
38
- # https://gitlab.windenergy.dtu.dk/surrogate-models/test-poetry-and-tensorflow
39
- tensorflow = {version = "^2.10.0", optional=true }
40
- tensorflow-io-gcs-filesystem = [
41
- {version = ">= 0.23.1", markers = "platform_machine!='arm64' or platform_system!='Darwin'", python=">=3.10,<3.12", optional=true},
42
- {version = "< 0.32.0", markers = "platform_system == 'Windows'", python=">=3.10,<3.12", optional=true}
43
- ]
44
- tensorflow-intel = {version="^2.10.0", platform = "win32", optional=true}
45
- keras = {version="^3.0.0", optional=true}
46
- smt = {version="^2.0.1", optional=true}
47
- openmdao = {version="^3.25", optional=true}
48
- torch = { version = "^2.0.0", optional=true }
49
-
50
- [tool.poetry.extras]
51
-
52
- docs = ["sphinx",
53
- "pydata-sphinx-theme",
54
- "sphinx-copybutton",
55
- "sphinx-sitemap",
56
- "sphinx_design",
57
- "numpydoc",
58
- "openmdao",
59
- ]
60
-
61
- code_style = ["black",
62
- "flake8",
63
- "isort",
64
- "codespell",
65
- ]
66
-
67
- test = ["matplotlib", # Needed by SMT.
68
- "pytest",
69
- "pytest-cov",
70
- "tomli",
71
- "scikit-learn",
72
- "smt",
73
- "tensorflow",
74
- "tensorflow-io-gcs-filesystem",
75
- "tensorflow-intel",
76
- "openmdao",
77
- "torch",
78
- ]
79
-
80
- smt = ["matplotlib", # Needed by SMT.
81
- "scikit-learn",
82
- "smt",
83
- ]
84
-
85
- tf = ["scikit-learn",
86
- "tensorflow",
87
- "tensorflow-io-gcs-filesystem",
88
- "tensorflow-intel",
89
- "keras",
90
- ]
91
-
92
- om = ["openmdao"]
93
-
94
- torch = ["torch",
95
- "scikit-learn",
96
- "keras",
97
- ]
98
-
99
-
100
-
101
- [build-system]
102
- build-backend = "poetry.core.masonry.api"
103
- requires = ["poetry-core", "numpy"]
104
-
105
- [tool.coverage.run]
106
- omit = ["surrogates_interface/test/*", ]
107
-
108
- [tool.coverage.report]
109
- fail_under = 100
110
-
111
- [tool.isort]
112
- profile = "black"
113
-
114
- [tool.codespell]
115
- ignore-words-list = "coo"