Start with first project.
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
data
|
||||||
|
grading
|
||||||
|
util.py
|
||||||
BIN
20Spring_martingale.zip
Normal file
BIN
20Spring_martingale.zip
Normal file
Binary file not shown.
BIN
ML4T_2020Spring.zip
Normal file
BIN
ML4T_2020Spring.zip
Normal file
Binary file not shown.
15
README.md
15
README.md
@@ -6,5 +6,20 @@ The page contains a link to the
|
|||||||
[assignments](http://quantsoftware.gatech.edu/CS7646_Spring_2020#Projects:_73.25).
|
[assignments](http://quantsoftware.gatech.edu/CS7646_Spring_2020#Projects:_73.25).
|
||||||
There are eight projects in total.
|
There are eight projects in total.
|
||||||
|
|
||||||
|
To set up the environment I have installed the following packages on my Linux
|
||||||
|
Manjaro based system.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo pacman -S python-pandas --asdeps python-pandas-datareader python-numexpr \
|
||||||
|
python-bottleneck python-jinja python-scipy python-matplotlib \
|
||||||
|
python-numpy
|
||||||
|
```
|
||||||
|
|
||||||
|
Use unzip with the `-n` flag to extract the archives for the different
|
||||||
|
exercises. This makes sure that you do not override any of the existing files. I
|
||||||
|
might add a makefile to automize this later.
|
||||||
|
|
||||||
|
```
|
||||||
|
unzip -n 20Spring_martingale.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
65
martingale/martingale.py
Normal file
65
martingale/martingale.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
"""Assess a betting strategy.
|
||||||
|
|
||||||
|
Copyright 2018, Georgia Institute of Technology (Georgia Tech)
|
||||||
|
Atlanta, Georgia 30332
|
||||||
|
All Rights Reserved
|
||||||
|
|
||||||
|
Template code for CS 4646/7646
|
||||||
|
|
||||||
|
Georgia Tech asserts copyright ownership of this template and all derivative
|
||||||
|
works, including solutions to the projects assigned in this course. Students
|
||||||
|
and other users of this template code are advised not to share it with others
|
||||||
|
or to make it available on publicly viewable websites including repositories
|
||||||
|
such as github and gitlab. This copyright statement should not be removed
|
||||||
|
or edited.
|
||||||
|
|
||||||
|
We do grant permission to share solutions privately with non-students such
|
||||||
|
as potential employers. However, sharing with other current or future
|
||||||
|
students of CS 7646 is prohibited and subject to being investigated as a
|
||||||
|
GT honor code violation.
|
||||||
|
|
||||||
|
-----do not edit anything above this line---
|
||||||
|
|
||||||
|
Student Name: Tucker Balch (replace with your name)
|
||||||
|
GT User ID: tb34 (replace with your User ID)
|
||||||
|
GT ID: 900897987 (replace with your GT ID)
|
||||||
|
"""
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
def author():
|
||||||
|
return 'tb34' # replace tb34 with your Georgia Tech username.
|
||||||
|
|
||||||
|
def gtid():
|
||||||
|
return 900897987 # replace with your GT ID number
|
||||||
|
|
||||||
|
def get_spin_result(win_prob):
|
||||||
|
result = False
|
||||||
|
if np.random.random() <= win_prob:
|
||||||
|
result = True
|
||||||
|
return result
|
||||||
|
|
||||||
|
def test_code():
|
||||||
|
win_prob = 18 / 38 # 18 black numbers out of 38 total numbers
|
||||||
|
np.random.seed(gtid()) # do this only once
|
||||||
|
|
||||||
|
episode_winnings = 0
|
||||||
|
winnings = [0]
|
||||||
|
while episode_winnings < 80:
|
||||||
|
won = False
|
||||||
|
bet_amount = 1
|
||||||
|
while not won:
|
||||||
|
won = get_spin_result(win_prob)
|
||||||
|
if won:
|
||||||
|
episode_winnings += bet_amount
|
||||||
|
else:
|
||||||
|
episode_winnings -= bet_amount
|
||||||
|
bet_amount *= 2
|
||||||
|
winnings.append(episode_winnings)
|
||||||
|
|
||||||
|
print(winnings)
|
||||||
|
|
||||||
|
# add your code here to implement the experiments
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_code()
|
||||||
Reference in New Issue
Block a user