modnn 3.0.9__tar.gz → 3.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.
- {modnn-3.0.9 → modnn-3.2.0}/LICENSE +7 -7
- {modnn-3.0.9 → modnn-3.2.0}/PKG-INFO +156 -115
- modnn-3.2.0/README.md +137 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Config.py +204 -175
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Dataset.py +436 -432
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Models/BaseNN.py +41 -41
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Models/ModNN_data.py +488 -438
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Models/ModNN_phy.py +403 -403
- modnn-3.2.0/modnn/Models/ModNN_v1.py +218 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Models/PolicyNN.py +41 -41
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Play.py +709 -722
- {modnn-3.0.9 → modnn-3.2.0}/modnn/__init__.py +12 -7
- {modnn-3.0.9 → modnn-3.2.0}/modnn/hyper_tune.py +158 -158
- modnn-3.2.0/modnn/run.py +37 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn/utils.py +860 -850
- {modnn-3.0.9 → modnn-3.2.0}/modnn.egg-info/PKG-INFO +156 -115
- {modnn-3.0.9 → modnn-3.2.0}/modnn.egg-info/SOURCES.txt +1 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn.egg-info/requires.txt +1 -0
- {modnn-3.0.9 → modnn-3.2.0}/pyproject.toml +34 -33
- {modnn-3.0.9 → modnn-3.2.0}/setup.cfg +4 -4
- modnn-3.0.9/README.md +0 -97
- modnn-3.0.9/modnn/run.py +0 -23
- {modnn-3.0.9 → modnn-3.2.0}/modnn/Models/__init__.py +0 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn.egg-info/dependency_links.txt +0 -0
- {modnn-3.0.9 → modnn-3.2.0}/modnn.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2024-2025 Zixin
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright 2024-2025 Zixin
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,115 +1,156 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: modnn
|
|
3
|
-
Version: 3.0
|
|
4
|
-
Summary: Physics-Informed Modularized Neural Network for Building Energy Modeling
|
|
5
|
-
Author-email: Zixin Jiang <zjiang19@syr.edu>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Requires-Python: >=3.7
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Requires-Dist: numpy
|
|
11
|
-
Requires-Dist: torch
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: matplotlib
|
|
14
|
-
Requires-Dist: seaborn
|
|
15
|
-
Requires-Dist: scikit-learn
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: modnn
|
|
3
|
+
Version: 3.2.0
|
|
4
|
+
Summary: Physics-Informed Modularized Neural Network for Building Energy Modeling
|
|
5
|
+
Author-email: Zixin Jiang <zjiang19@syr.edu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: torch
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: matplotlib
|
|
14
|
+
Requires-Dist: seaborn
|
|
15
|
+
Requires-Dist: scikit-learn
|
|
16
|
+
Requires-Dist: scipy
|
|
17
|
+
Requires-Dist: tqdm
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# ModNN
|
|
21
|
+
|
|
22
|
+
**ModNN** is a Modularized Physics-Informed Neural Network for building energy modeling.
|
|
23
|
+
|
|
24
|
+
It incorporates with physics-informed model structure, loss function, and model constraints.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚀 Installation
|
|
29
|
+
|
|
30
|
+
You can install the package using pip:
|
|
31
|
+
|
|
32
|
+
pip install modnn
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## 🧠 Example
|
|
37
|
+
Please find the online Jupyter notebook for a step-by-step instruction:
|
|
38
|
+
https://colab.research.google.com/drive/1A2jt1q53RtxGuaoym6N1PmlKELDPpYFX?usp=sharing
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## ⚡ Quick start
|
|
42
|
+
Your CSV needs a datetime index and the columns `temp_room`, `temp_amb`, `solar`, `occ` and `phvac`.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from modnn import get_config, Mod
|
|
46
|
+
|
|
47
|
+
args = get_config({"datapath": "your_data.csv"})
|
|
48
|
+
model = Mod(args)
|
|
49
|
+
model.data_ready() # or model.data_ready(df) with a pandas DataFrame
|
|
50
|
+
model.train()
|
|
51
|
+
model.load()
|
|
52
|
+
model.test()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
or from the command line: `python -m modnn.run your_data.csv`
|
|
56
|
+
|
|
57
|
+
Scalers, checkpoints, trained models, results and figures are written to `./modnn_output`
|
|
58
|
+
(change with `"output_dir"`). The GPU is used when available, otherwise the CPU.
|
|
59
|
+
|
|
60
|
+
## 🧩 Model options
|
|
61
|
+
| option | values | meaning |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `architecture` | `"v3"` (default), `"v1"` | `"v1"` is the first-generation model (LSTM envelope, as in 1.0.1) |
|
|
64
|
+
| `ext_input` | `"state"` (default), `"delta"` | envelope module input: [T_zone, T_ambient] or T_ambient - T_zone (as in 3.0.0) |
|
|
65
|
+
| `constraints` | any of `"hvac"`, `"internal"`, `"ambient"`, `"solar"` | inputs whose effect on zone temperature must follow physics (default `["hvac", "internal"]`) |
|
|
66
|
+
|
|
67
|
+
`"ambient"` and `"solar"` constrain the envelope module and need `architecture="v3"` with `ext_mdl="RNN"`.
|
|
68
|
+
For example, a model whose responses to HVAC, occupancy, weather and sun all follow physics:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
args = get_config({"datapath": "your_data.csv", "ext_input": "delta",
|
|
72
|
+
"constraints": ["hvac", "internal", "ambient", "solar"]})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 🧠 Update log
|
|
76
|
+
# 🧠 [2.0.0] 2025 May 9
|
|
77
|
+
To further improve physical consistency,
|
|
78
|
+
|
|
79
|
+
I replaced heat transfer module by set of energy balance equations,
|
|
80
|
+
|
|
81
|
+
Start from version 2.0.0
|
|
82
|
+
|
|
83
|
+
# 🧠 [2.0.1] 2025 May 10
|
|
84
|
+
Add another parameter: "envelop_mdl",
|
|
85
|
+
|
|
86
|
+
Allow user to use the new physics based module or previous data driven module.
|
|
87
|
+
|
|
88
|
+
# 🧠 [2.0.2] 2025 May 10
|
|
89
|
+
Fix bug due to parameter: "envelop_mdl",
|
|
90
|
+
|
|
91
|
+
Vectorize calculation,speed improved by ~6 times.
|
|
92
|
+
|
|
93
|
+
# 🧠 [3.0.0] 2025 June 11
|
|
94
|
+
Update datadriven modnn
|
|
95
|
+
RC based envelop_mdl really hard to tune on new dataset
|
|
96
|
+
|
|
97
|
+
# 🧠 [3.0.1] 2025 June 11
|
|
98
|
+
Add a step function for one step ahead prediction
|
|
99
|
+
|
|
100
|
+
# 🧠 [3.0.2] 2025 June 11
|
|
101
|
+
Fix bug for step function
|
|
102
|
+
|
|
103
|
+
# 🧠 [3.0.3] 2025 June 11
|
|
104
|
+
Fix bug for step function
|
|
105
|
+
|
|
106
|
+
# 🧠 [3.0.4] 2025 Sept 10
|
|
107
|
+
Didn't work on it for 3 months, just update the latest version
|
|
108
|
+
Will use it for BESTOpt building dynamic model
|
|
109
|
+
|
|
110
|
+
# 🧠 [3.0.5] 2025 Sept 15
|
|
111
|
+
3.0.4 CAN-NOT work at all, I mistakenly comment one line and add a new line of code
|
|
112
|
+
|
|
113
|
+
# 🧠 [3.0.6] 2025 Sept 15
|
|
114
|
+
Fix temperature unit conversion issue
|
|
115
|
+
|
|
116
|
+
# 🧠 [3.0.7] 2025 Sept 15
|
|
117
|
+
Fix step model zone module dimension issue
|
|
118
|
+
|
|
119
|
+
# 🧠 [3.1.0] 2026 Sept 25
|
|
120
|
+
New options: "architecture" (v1/v3) and "ext_input" (state/delta); physical constraints applied through `model.apply_constraints()`
|
|
121
|
+
|
|
122
|
+
Easier to use: `from modnn import get_config, Mod`, `python -m modnn.run your_data.csv`, outputs in `./modnn_output`
|
|
123
|
+
(previously `../`), device defaults to "cuda" with CPU fallback, clear errors for a missing data file or column, scipy added to requirements
|
|
124
|
+
|
|
125
|
+
# 🧠 [3.2.0] 2026 Sept 25
|
|
126
|
+
Choose which responses are physically constrained with `"constraints"`: any of "hvac", "internal", "ambient", "solar"
|
|
127
|
+
|
|
128
|
+
Presets removed
|
|
129
|
+
|
|
130
|
+
## 🧪 Requirements
|
|
131
|
+
|
|
132
|
+
Python 3.7+
|
|
133
|
+
|
|
134
|
+
PyTorch
|
|
135
|
+
|
|
136
|
+
NumPy
|
|
137
|
+
|
|
138
|
+
Pandas
|
|
139
|
+
|
|
140
|
+
Matplotlib
|
|
141
|
+
|
|
142
|
+
Seaborn
|
|
143
|
+
|
|
144
|
+
scikit-learn
|
|
145
|
+
|
|
146
|
+
tqdm
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
📬 License
|
|
150
|
+
|
|
151
|
+
MIT License
|
|
152
|
+
|
|
153
|
+
🙋♂️ Author
|
|
154
|
+
|
|
155
|
+
Zixin Jiang:
|
|
156
|
+
zjiang19@syr.edu
|
modnn-3.2.0/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# ModNN
|
|
2
|
+
|
|
3
|
+
**ModNN** is a Modularized Physics-Informed Neural Network for building energy modeling.
|
|
4
|
+
|
|
5
|
+
It incorporates with physics-informed model structure, loss function, and model constraints.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Installation
|
|
10
|
+
|
|
11
|
+
You can install the package using pip:
|
|
12
|
+
|
|
13
|
+
pip install modnn
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 🧠 Example
|
|
18
|
+
Please find the online Jupyter notebook for a step-by-step instruction:
|
|
19
|
+
https://colab.research.google.com/drive/1A2jt1q53RtxGuaoym6N1PmlKELDPpYFX?usp=sharing
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## ⚡ Quick start
|
|
23
|
+
Your CSV needs a datetime index and the columns `temp_room`, `temp_amb`, `solar`, `occ` and `phvac`.
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from modnn import get_config, Mod
|
|
27
|
+
|
|
28
|
+
args = get_config({"datapath": "your_data.csv"})
|
|
29
|
+
model = Mod(args)
|
|
30
|
+
model.data_ready() # or model.data_ready(df) with a pandas DataFrame
|
|
31
|
+
model.train()
|
|
32
|
+
model.load()
|
|
33
|
+
model.test()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
or from the command line: `python -m modnn.run your_data.csv`
|
|
37
|
+
|
|
38
|
+
Scalers, checkpoints, trained models, results and figures are written to `./modnn_output`
|
|
39
|
+
(change with `"output_dir"`). The GPU is used when available, otherwise the CPU.
|
|
40
|
+
|
|
41
|
+
## 🧩 Model options
|
|
42
|
+
| option | values | meaning |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| `architecture` | `"v3"` (default), `"v1"` | `"v1"` is the first-generation model (LSTM envelope, as in 1.0.1) |
|
|
45
|
+
| `ext_input` | `"state"` (default), `"delta"` | envelope module input: [T_zone, T_ambient] or T_ambient - T_zone (as in 3.0.0) |
|
|
46
|
+
| `constraints` | any of `"hvac"`, `"internal"`, `"ambient"`, `"solar"` | inputs whose effect on zone temperature must follow physics (default `["hvac", "internal"]`) |
|
|
47
|
+
|
|
48
|
+
`"ambient"` and `"solar"` constrain the envelope module and need `architecture="v3"` with `ext_mdl="RNN"`.
|
|
49
|
+
For example, a model whose responses to HVAC, occupancy, weather and sun all follow physics:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
args = get_config({"datapath": "your_data.csv", "ext_input": "delta",
|
|
53
|
+
"constraints": ["hvac", "internal", "ambient", "solar"]})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 🧠 Update log
|
|
57
|
+
# 🧠 [2.0.0] 2025 May 9
|
|
58
|
+
To further improve physical consistency,
|
|
59
|
+
|
|
60
|
+
I replaced heat transfer module by set of energy balance equations,
|
|
61
|
+
|
|
62
|
+
Start from version 2.0.0
|
|
63
|
+
|
|
64
|
+
# 🧠 [2.0.1] 2025 May 10
|
|
65
|
+
Add another parameter: "envelop_mdl",
|
|
66
|
+
|
|
67
|
+
Allow user to use the new physics based module or previous data driven module.
|
|
68
|
+
|
|
69
|
+
# 🧠 [2.0.2] 2025 May 10
|
|
70
|
+
Fix bug due to parameter: "envelop_mdl",
|
|
71
|
+
|
|
72
|
+
Vectorize calculation,speed improved by ~6 times.
|
|
73
|
+
|
|
74
|
+
# 🧠 [3.0.0] 2025 June 11
|
|
75
|
+
Update datadriven modnn
|
|
76
|
+
RC based envelop_mdl really hard to tune on new dataset
|
|
77
|
+
|
|
78
|
+
# 🧠 [3.0.1] 2025 June 11
|
|
79
|
+
Add a step function for one step ahead prediction
|
|
80
|
+
|
|
81
|
+
# 🧠 [3.0.2] 2025 June 11
|
|
82
|
+
Fix bug for step function
|
|
83
|
+
|
|
84
|
+
# 🧠 [3.0.3] 2025 June 11
|
|
85
|
+
Fix bug for step function
|
|
86
|
+
|
|
87
|
+
# 🧠 [3.0.4] 2025 Sept 10
|
|
88
|
+
Didn't work on it for 3 months, just update the latest version
|
|
89
|
+
Will use it for BESTOpt building dynamic model
|
|
90
|
+
|
|
91
|
+
# 🧠 [3.0.5] 2025 Sept 15
|
|
92
|
+
3.0.4 CAN-NOT work at all, I mistakenly comment one line and add a new line of code
|
|
93
|
+
|
|
94
|
+
# 🧠 [3.0.6] 2025 Sept 15
|
|
95
|
+
Fix temperature unit conversion issue
|
|
96
|
+
|
|
97
|
+
# 🧠 [3.0.7] 2025 Sept 15
|
|
98
|
+
Fix step model zone module dimension issue
|
|
99
|
+
|
|
100
|
+
# 🧠 [3.1.0] 2026 Sept 25
|
|
101
|
+
New options: "architecture" (v1/v3) and "ext_input" (state/delta); physical constraints applied through `model.apply_constraints()`
|
|
102
|
+
|
|
103
|
+
Easier to use: `from modnn import get_config, Mod`, `python -m modnn.run your_data.csv`, outputs in `./modnn_output`
|
|
104
|
+
(previously `../`), device defaults to "cuda" with CPU fallback, clear errors for a missing data file or column, scipy added to requirements
|
|
105
|
+
|
|
106
|
+
# 🧠 [3.2.0] 2026 Sept 25
|
|
107
|
+
Choose which responses are physically constrained with `"constraints"`: any of "hvac", "internal", "ambient", "solar"
|
|
108
|
+
|
|
109
|
+
Presets removed
|
|
110
|
+
|
|
111
|
+
## 🧪 Requirements
|
|
112
|
+
|
|
113
|
+
Python 3.7+
|
|
114
|
+
|
|
115
|
+
PyTorch
|
|
116
|
+
|
|
117
|
+
NumPy
|
|
118
|
+
|
|
119
|
+
Pandas
|
|
120
|
+
|
|
121
|
+
Matplotlib
|
|
122
|
+
|
|
123
|
+
Seaborn
|
|
124
|
+
|
|
125
|
+
scikit-learn
|
|
126
|
+
|
|
127
|
+
tqdm
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
📬 License
|
|
131
|
+
|
|
132
|
+
MIT License
|
|
133
|
+
|
|
134
|
+
🙋♂️ Author
|
|
135
|
+
|
|
136
|
+
Zixin Jiang:
|
|
137
|
+
zjiang19@syr.edu
|