Would be nice to retransform the output into an interval / gaussian distribution
Note: If you're curious why there is a negative number (-5) in the histogram, that's just an inevitable downside of the simplicity of the Unsure Calculator. Without further knowledge, the calculator cannot know that a negative number is impossible
Drake Equation or equation multiplying probabilities can also be seen in log space, where the uncertainty is on the scale of each probability, and the final probability is the product of exponential of the log probabilities. And we wouldnt have this negative issue
It sounds like a gimmick at first, but looks surprisingly useful. I'd surely install it if it was available as an app to use alongside my usual calculator, and while I cannot quite recall a situation when I needed it, it seems very plausible that I'll start finding use cases once I have it bound to some hotkey on my keyboard.
An alternative approach is using fuzzy-numbers. If evaluated with interval arithmetic you can do very long calculations involving uncertain numbers very fast and with strong mathematical guarantees.
It would especially outperform the Monte-Carlo approach drastically.
I didn't peruse the source code. I just read the linked article in its entirety and it says
> The computation is quite slow. In order to stay as flexible as possible, I'm using the Monte Carlo method. Which means the calculator is running about 250K AST-based computations for every calculation you put forth.
So therefore I conclude Monte Carlo is being used.
Line 19 to 21 should be the Monte-Carlo sampling algorithm. The implementation is maybe a bit unintuitive but apparently he creates a function from the expression in the calculator, calling that function gives a random value from that function.
I actually stumbled upon this a while ago from social media and the web version has a somewhat annoying latency, so I wrote my own version in Python. It uses numpy so it's faster. https://gist.github.com/kccqzy/d3fa7cdb064e03b16acfbefb76645... Thank you filiph for this brilliant idea!
> Range is always a normal distribution, with the lower number being two standard deviations below the mean, and the upper number two standard deviations above. Nothing fancier is possible, in terms of input probability distributions.
I love this! As a tool for helping folks with a good base in arithmetic develop statistical intuition, I can't think offhand of what I've seen that's better.
i like it and i skimmed the post but i don't understand why the default example 100 / 4~6 has a median of 20? there is no way of knowing why the range is between 4 and 6
Would be nice to retransform the output into an interval / gaussian distribution
Drake Equation or equation multiplying probabilities can also be seen in log space, where the uncertainty is on the scale of each probability, and the final probability is the product of exponential of the log probabilities. And we wouldnt have this negative issueIt sounds like a gimmick at first, but looks surprisingly useful. I'd surely install it if it was available as an app to use alongside my usual calculator, and while I cannot quite recall a situation when I needed it, it seems very plausible that I'll start finding use cases once I have it bound to some hotkey on my keyboard.
Feature request: allow specifying the probability distribution. E.g.: ‘~’: normal, ‘_’: uniform, etc.
An alternative approach is using fuzzy-numbers. If evaluated with interval arithmetic you can do very long calculations involving uncertain numbers very fast and with strong mathematical guarantees.
It would especially outperform the Monte-Carlo approach drastically.
This assumes the inputs are uniform distributions, or perhaps normals depending on what exactly fuzzy numbers mean. M-C is not so limited.
No. It assumes the numbers aren't random at all.
Although fuzzy-number can be used to model many different kinds of uncertainties.
I perused the codebase but I'm unfamiliar with dart:
https://github.com/filiph/unsure/blob/master/lib/src/calcula...
I assume this is a montecarlo approach? (Not to start a flamewar, at least for us data scientists :) ).
Yes it is.
Can you explain how? I'm an (aspiring)
I didn't peruse the source code. I just read the linked article in its entirety and it says
> The computation is quite slow. In order to stay as flexible as possible, I'm using the Monte Carlo method. Which means the calculator is running about 250K AST-based computations for every calculation you put forth.
So therefore I conclude Monte Carlo is being used.
Line 19 to 21 should be the Monte-Carlo sampling algorithm. The implementation is maybe a bit unintuitive but apparently he creates a function from the expression in the calculator, calling that function gives a random value from that function.
Smol Show HN thread a few years ago https://news.ycombinator.com/item?id=22630600
I actually stumbled upon this a while ago from social media and the web version has a somewhat annoying latency, so I wrote my own version in Python. It uses numpy so it's faster. https://gist.github.com/kccqzy/d3fa7cdb064e03b16acfbefb76645... Thank you filiph for this brilliant idea!
This reminds me of https://www.getguesstimate.com/ , a probabilistic spreadsheet.
The authors of Guesstimate are now working on https://www.squiggle-language.com/
Someone also turned it into the https://github.com/rethinkpriorities/squigglepy python library
I was looking for this. Seen it (or a similar tool) ages ago.
Want to use it every 3 months or so to pretend that we know what we can squeeze in the roadmap for the quarter.
cool! are all ranges considered poisson distributions?
No:
> Range is always a normal distribution, with the lower number being two standard deviations below the mean, and the upper number two standard deviations above. Nothing fancier is possible, in terms of input probability distributions.
I love this! As a tool for helping folks with a good base in arithmetic develop statistical intuition, I can't think offhand of what I've seen that's better.
is this the same as error propagation? I used to do a lot of that during my physics degree
It doesn't propagate uncertainty through the computation, but rather treats the expression as a single random variable.
i like it and i skimmed the post but i don't understand why the default example 100 / 4~6 has a median of 20? there is no way of knowing why the range is between 4 and 6
The chance of 4~6 being less than 5 is 50%, the chance of it being greater is also 50%. The median of 100/4~6 has to be 100/5.
>there is no way of knowing why the range is between 4 and 6
??? There is. It is the ~ symbol.
how do you mean?
This is terrific and it’s tempting to turn into a little python package. +1 for notation to say it’s ~20,2 to mean 18~22
brilliant work, polished ui. although sometimes give wrong ranges for equations like 100/1~(200~2000)
Can you elaborate? What is the answer you’re getting and what answer would you expect?
How do you process this equation ? 100 divided by something from one to ...?
> 100 / 4~6
Means "100 divided by some number between 4 and 6"