Sum functions by x value (potential solution: inverse function; solution to simpler version: ordering lists) #1044
Replies: 9 comments 4 replies
-
There might be neat things you guys are already doing for distributions that we could maybe port over to this use case (e.g. inverting cdfs) maybe a hacky solution is forcing the function into a degenerate distribution |
Beta Was this translation helpful? Give feedback.
-
another potential solution to the more complex/more general case:
so my guess is we could get a hacky version of the general case with just list ordering? |
Beta Was this translation helpful? Give feedback.
-
Seems like it got cut off at the end. |
Beta Was this translation helpful? Give feedback.
-
I feel like to do this well, directly in Squiggle, would probably want for loops and mutation. This would probably require a lot of changes. In the meantime, we could implement functions directly in Squiggle. Like, |
Beta Was this translation helpful? Give feedback.
-
Yeah makes sense! haha, I like Danger.accumulateCurves. My guess is that this is not-performance-light, so probably better to have directly integrate anyway. |
Beta Was this translation helpful? Give feedback.
-
Here's a hacky quick implementation for doing this for two grant marg returns curves in squiggle: `
} |
Beta Was this translation helpful? Give feedback.
-
Following up on Ozzie's point, we can:
I'm feeling curious about how 2 & 3 go, and I'd been meaning to go back to writing some squiggle code, so might assign this task to myself to work on over the next few days. |
Beta Was this translation helpful? Give feedback.
-
Another, more complex version:
the gnarly thing here is that really for each sample of the distribution over how much of each you'd find, you'd want to redo the portfolio optimization (which gets performance impossible currently) Also, re the above hacky implementation, that obviously gets slow if you try to do for more than 2 DMR curves by nesting. |
Beta Was this translation helpful? Give feedback.
-
Ok, one more different use case that isn't the same as above, but also uses function inversion: here it's very simple: have f(x), want f^-1(x)
|
Beta Was this translation helpful? Give feedback.
-
Ex:
A simpler version could be not having DMR curves for each grant, but just a dollar size and (average) cost-effectiveness attached. Then, you'd just need need to order a list of ["projectname", cost-effectiveness] by cost-effectiveness.
I'm not sure how to best achieve this. For the simpler version, we'd just need the ability to order lists, but I don't think Squiggle has that yet?
For the complex thing, maybe there are neat solutions to this with some programming creativity.
--
Idea for complex thing:
I'm not sure how to best achieve the inversion.
--
This would get even more complicated if project1MarginalValueOfDollar(dollars) is a distribution (or cost-effectiveness of each project, in the simpler case). These distributions would also be correlated.
(Might be easiest to start by making this for numeric values, just using the means.)
--
This would be a common use case for me.
Beta Was this translation helpful? Give feedback.
All reactions