Problem
We have some situation, and want to calculate the probability of some outcome / some value ,but we have no analytical model for it.
We want to have some answer to the given question, and don't want to spend 1 week/month/year on developing some analytical model.
Idea
Use "Monte Carlo" (famous casino) methods.
All that you need:
- code that describes the logic of the problem (game logic, math problem, assets prediction)
- some Random Numbers Generator (python built-ins)
Process:
- Set the amount of loops, it must be big for the good simulation: 100.000, 1.000.000, 10.000.000 (amount larger $\rightarrow$ prediction better, not linearly, but logarithmically)
- In each iteration:
- generate random values for the problem
- use them for calculating the solution for this numbers
- add the result to global result set
- Compute the mean for the global result set after all iterations
Pros and Cons
Pros:
- easy to code - simply write down the problem logic and simulate it with random numbers many times
- good for cases, when you need only the answer, and not interested in the generalizing
- fast for cases, when you want a "good but not necessary exactly" approximation (~95-99%)