Add new `generate.functions.FractionalSum`
brews opened this issue · comments
Related to PR #31. Maybe needed to progress on Labor projections.
This issue is continuing a post by @jrising in #31 (comment):
While I have no problem with us having a Product calculation, I think there are still reasons to prefer a
FractionalSum
calculation object: you avoid the 1 - X problem, you can check that the fraction has no units and stays within bounds, the formatted code can be cleaner and the argument types more informative. But the partial derivative of a FractionalSum is a Sum of a FractionalSum and a Product, so you would still need to have this Product class anyway.
The goal here is to talk about whether it's needed, what's needed to make it work and what this thing might look like in the interface.
Okay, @jrising, what are you thinking on how to handle the 1 - X problem, and bound checks with a FractionalSum
.
What does the signature look like to you?
The yaml from our initial discussion:
timerate: day
climate: [ tasmax, tasmax_rcspline ]
models:
- csvvs: social/parameters/labor/csvv_spline_jan2020_corrected/*.csvv
specifications:
minlost_hi:
csvv-subset: 1 - 12
functionalform: cubicspline
prefix: tasmax_rcspline
variable: tasmax
minlost_lo:
csvv-subset: 13 - 24
functionalform: cubicspline
prefix: tasmax_rcspline
variable: tasmax
riskshare:
csvv-subset: 25 - 30
...
calculation:
- FractionProduct:
- YearlyAverageDay:
riskshare
- YearlyAverageDay:
minlost_hi
- YearlyAverageDay:
minlost_lo
- Rebase
In our talk you also mentioned replicating something like Excels' SumProduct
but we couldn't remember its name.
Yes, that seems fine. Note that riskshare
will need that csvv-subset-depenunit
fix to specify that it's unitless. And you got the excel function name right.
@jrising My impression was that csvv-subset-depenunit
is something that should be implemented downstream in impact-calulations
and not in open-estimate
?
@brews Totally. I just mentioned it because your config file isn't consistent without it.
Alternatively, we can offer people a way to use multiple CSVV files (which would naturally have different dependent variable units), associated with different submodels. But there are many ways that might work. Also for impact-calculations
.