This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import minimize_scalar | |
def moneyh(R): | |
""" save 1$ every month for 28 month | |
Args: | |
R: annualised yearly interest rate | |
Returns: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Blackjack simulator, works for RL | |
* Copied and modified from: | |
https://gist.github.com/mjhea0/5680216 | |
* See function game(get_player_action) for instructions. | |
* Requires Python 3.7 | |
* Handles 10M simulations in < 30 mins at Macbook Pro | |
* Interactive play: python blackjack_simu.py | |
* Might not implement blackjack rules perfectly | |
""" | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Generate data from different distributions, fit a log-normal and | |
show how much fitted mean overvaluates data mean. | |
Overvaluation 0.05 = 5% higher fitted log-norm mean than data mean. | |
Copy-paste of output: | |
* log normal data | |
- mean(empirical data): 4.22, mean(fitted long-norm): 4.26, overvaluation: 0.01 |