You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/log.md
+38-12Lines changed: 38 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,8 @@ Used [llm_simpy/notebooks/03_stroke/00_stress/](https://github.com/pythonhealthd
20
20
21
21
Renamed and created environment.
22
22
23
-
> **Reflections:**
24
-
>
23
+
> 💡 **Reflections...**
24
+
>
25
25
> * Could encourage / suggestion Allyon 2021 [Keeping modelling notebooks with TRACE: Good for you and good for environmental research and management support](https://www.sciencedirect.com/science/article/pii/S1364815220309890).
26
26
> * Template README could have space for orcid.
27
27
> * Would have been handy for template README to give an example of giving credit to template.
@@ -172,27 +172,53 @@ Also, we could import these values from a file as well? For now though, will sti
172
172
173
173
Then I ran pylint, and add pylint disablers for too many arguments.
174
174
175
-
> **Reflections:**
176
-
>
177
-
> * Handy to consider this way of structuring, for models with lots of parameters (which can be fairly common).
175
+
> 💡Handy to consider this way of structuring, for models with lots of parameters (which can be fairly common).
178
176
179
177
## Clearing out
180
178
181
179
I removed most files... it was overwhelming and tricky to work with, if I am changing and breaking things, and that breaks all my tests, and so on.
182
180
183
-
> **Reflections:**
184
-
>
185
-
> I realise the templates are a little daunting - and I wrote them! Getting started with this, I did the strategy of essentially "clearing things away" - and then referring back to them as I got set up again. Perhaps a more useable / accessible version of these templates would be structuring them as step-by-step quarto books. Because that's essentially how am I treating them - AND that is how I learnt best, when I was learning DES, is working through step-by-step with the HSMA book, building it up. So these templates are me having worked out how to implement everything we want - and then the applied examples is stress testing / real life testing, figuring out how we work through, where we make changes - and using all that then to write step-by-step tutorial books. One for Python, one for R. Step-by-step walkthough of RAP DES in XYZ.
181
+
> 💡 I realise the templates are a little daunting - and I wrote them! Getting started with this, I did the strategy of essentially "clearing things away" - and then referring back to them as I got set up again. Perhaps a more useable / accessible version of these templates would be structuring them as step-by-step quarto books. Because that's essentially how am I treating them - AND that is how I learnt best, when I was learning DES, is working through step-by-step with the HSMA book, building it up. So these templates are me having worked out how to implement everything we want - and then the applied examples is stress testing / real life testing, figuring out how we work through, where we make changes - and using all that then to write step-by-step tutorial books. One for Python, one for R. Step-by-step walkthough of RAP DES in XYZ.
186
182
187
183
## Back to parameters
188
184
185
+
### Refactoring
186
+
187
+
With so many parameters, I feel like it maybe makes sense to seperate out the code more than I did in the template, so have changed from `model.py` to `parameters.py`
188
+
189
+
> 💡 Could the location of functions in the template do with reorganising? What is clearest?
190
+
191
+
### Playing with them
192
+
193
+
I wanted to try out using the classes to make sure they work. I created a disposable notebook to play around with them in.
194
+
195
+
> 💡 Should be clear how we do this early on, so can play about with it.
196
+
197
+
I realised dataclasses don't allow you to call ASUArrivals(stroke=4), as they are recognised as attributes, but only recognised as parameters when you type hint ie.
198
+
199
+
```
200
+
@dataclass
201
+
class ASUArrivals:
202
+
stroke: float = 1.2
203
+
tia: float = 9.3
204
+
neuro: float = 3.6
205
+
other: float = 3.2
206
+
207
+
ASUArrivals(stroke=4)
208
+
```
209
+
210
+
I don't want this weird/hidden-feeling behaviour, especially as people say type hints shouldn't functionally affect your code in Python, and so will stick with normal classes.
211
+
189
212
### Preventing addition of new attributes
190
213
191
214
From writing the templates, I know how important it is that we prevent the addition of new attributes.
192
215
193
216
In python, I do this using a method in the parameter class. This is also possible in R if set up as a R6Class, but I chose to use a function for simplicity, so that instead checks the parameters when they are input to model. The downside of that approach as it will check every time the model is called (i.e. with each replication).
194
217
195
-
> **Reflections:**
196
-
>
197
-
> * Emphasising the importance of this, that it's not just something to drop.
198
-
> * Using the dataclasses, our provided method for preventing the addition of new attributes no longer works.
218
+
However, an alternative would be for my parameter classes to **inherit** from a main class with that functionality.
219
+
220
+
> 💡 Emphasise the importance of this, that it's not just something to drop.
221
+
222
+
> 💡 When using the dataclasses, our provided method for preventing the addition of new attributes no longer works.
223
+
224
+
I set up the **parent class**, and then add **tests** which check this is functioning properly.
0 commit comments