Commit a793417
Refactor differenced processes, random walks, and AR processes (#380)
* Checkpoint commit on differencedar
* Checkpoint commit on differencedar
* Add de-differencing helper and tests
* Replace fori_loop with scan
* Fix bugs and typos in integrator, add test
* Fix name of StandardNormalRandomWalk
* Try two random walk impelmentations
* Fix bug in differenced process
* Fix some tests, add dynamic versus static DistributionalRVs
* Split distributional RVs into static and dynamic
* Update DistributionalRV kwarg dist => distribution in all tests
* update dist => distribution kwarg in DistributionalRV in all tutorials
* Add tests for DistributionalRV factory and classes
* Allow scalars to play better with scan, give more informative error messages for incompatible arrays in certain scan functions
* Autoformat files
* Rename infection_initialization tests to be consistent with name of tested classes, refactor all tests to work with new process module, ensure that DifferencedProcess samples the fundamental process n-1 times to account for inits, use pytest.mark.parametrize in rw sample distribution test
* Fix typo
* Refactor AR and update tests
* Refactor RtPeriodicDiff to use DifferencedProcess and ARProcess; delete unused manual AR function
* Default names for now
* Fundamental process init passthrough for differencedprocess, update tutorials
* Fix typo in IIDRandomSequence class name, add test for class
* Apply suggestions from code review
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Reintroduce test_rtperiodicdiff, removing manual reconstruction test that did not use the sampling method
* Coerce to 1d in the appropriate place in infectionswithfeedback
* Reintroduce padding
* Coerce to array in tutorial
* Fix tutorial bug
* Update model/src/pyrenew/process/differencedprocess.py
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Restore padding in test_model_basic_renewal
* Restore padding in test in a couple other places
* Apply suggestions from code review
revert to using gen_int.size() method
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Convert sds to scalars in test ar process
* Rename PeriodicDiff classes to highlight that they are DiffAR processes
* Move model up one level
* Add expand method for distributional rvs
* Mathtext and refs for differencedprocess class
* Mathtext typo fixes and doc improvements for DifferencedProcess
* More sphinx tweaks
* More typos
* Test for standard normal sequence
* Float expectations
* Add scipy to testing deps
* Update pyproject for deptry
* scipy allowed to be dev dep
* Add test for vectorized sampling
* Raise ValueError if noise sd not scalar
* Fix expand_by() tests to use new syntax
* Manual tests for integrator correctness, better documentation of output shape, revise sample method so that n is chosen properly
* Fix distributional rv test
* Raise eror for overly short DifferenceProcess samples; test for that error raise
* Force differencedprocess to deal with 1D diffs and error otherwise, make it behave as expected for 0 < n < order
* Fix scipy dep
* Update test
* Improve error message
* Autoformat files
* Update tutorials
* More checks and clearer code for differencedprocess.py
* Update src/pyrenew/process/differencedprocess.py
Update link to Hyndman textbook
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Update src/pyrenew/process/differencedprocess.py
Fix out of date inaccurate docstring
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Update src/pyrenew/process/differencedprocess.py
Co-authored-by: Damon Bayer <xum8@cdc.gov>
* Remove names for DifferencedProcess
* Change refs to expected shape
* One missing edit in test
* Restore incorrectly removed test
* Update random walk tests
* Make AR strict about 1d input arrays
* Configurable AR process name in rtperiodicdiffar class
* Added check comparing to first initial value to small sample test
* Remove unused function
* Remove required names and adjust tests and structure accordingly
* replace :fun: sphinx directives
* Fix one more :fun:
* And yet one more :fun:
---------
Co-authored-by: Damon Bayer <xum8@cdc.gov>1 parent 7ad81f1 commit a793417
38 files changed
Lines changed: 1500 additions & 708 deletions
File tree
- docs/source/tutorials
- src
- pyrenew
- deterministic
- latent
- model
- process
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 150 | + | |
157 | 151 | | |
158 | 152 | | |
159 | 153 | | |
160 | 154 | | |
161 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
| |||
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
| 134 | + | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
73 | 89 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
78 | 94 | | |
79 | 95 | | |
80 | 96 | | |
| |||
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
88 | | - | |
| 104 | + | |
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
| |||
209 | 225 | | |
210 | 226 | | |
211 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
212 | 231 | | |
213 | | - | |
| 232 | + | |
214 | 233 | | |
215 | | - | |
| 234 | + | |
216 | 235 | | |
217 | 236 | | |
218 | 237 | | |
| |||
260 | 279 | | |
261 | 280 | | |
262 | 281 | | |
263 | | - | |
| 282 | + | |
264 | 283 | | |
265 | 284 | | |
266 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
195 | | - | |
196 | | - | |
| 193 | + | |
| 194 | + | |
197 | 195 | | |
198 | 196 | | |
199 | | - | |
200 | | - | |
| 197 | + | |
| 198 | + | |
201 | 199 | | |
202 | 200 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 201 | + | |
207 | 202 | | |
208 | 203 | | |
209 | 204 | | |
210 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
211 | 210 | | |
212 | | - | |
| 211 | + | |
213 | 212 | | |
214 | 213 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 214 | + | |
220 | 215 | | |
221 | 216 | | |
222 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
113 | | - | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
121 | | - | |
| 125 | + | |
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
| |||
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
| 180 | + | |
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
180 | | - | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
100 | | - | |
101 | 98 | | |
102 | 99 | | |
103 | 100 | | |
| |||
0 commit comments