This file contains 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
date,confidence | |
2013-3-26,59.7 | |
2013-2-26,69 | |
2013-1-29,58.6 | |
2012-12-27,65.1 | |
2012-11-27,73.7 | |
2012-10-1,72.2 | |
2012-9-25,70.3 | |
2012-8-28,60.6 | |
2012-7-31,65.9 |
This file contains 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
DATE,Ratio | |
11/1/2006,0.91 | |
11/2/2006,0.9 | |
11/3/2006,0.91 | |
11/6/2006,0.76 | |
11/7/2006,0.79 | |
11/8/2006,0.78 | |
11/9/2006,0.84 | |
11/10/2006,1.06 | |
11/13/2006,0.8 |
This file contains 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 | |
import gzip | |
import json | |
def get_relative_frame(frame, position, new_position=(0,0)): | |
""" Rolls a frame such that position is moved to new_position | |
Input: | |
frame: 2-dimensional array | |
position: tuple (row, col) |
This file contains 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 os | |
import pickle | |
import tensorflow as tf | |
from sklearn.model_selection import train_test_split | |
with open('djma_v3.pkl', 'rb') as input: | |
data = pickle.load(input) | |
X = data["X"] | |
y = data["y"] |
This file contains 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
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.callbacks import EarlyStopping | |
import pickle | |
import numpy as np | |
import json | |
def get_relative_frame(frame, position, new_position=(0,0)): |
This file contains 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 | |
import gym | |
from itertools import product | |
def init_centers(num_splits=4, num_obs=2): | |
""" Returns [num_splits**num_obs, num_obs] matrix of equidistant centers from (0,0) to (1,1) """ | |
return np.array(list(product(np.linspace(0,1,num_splits),repeat=num_obs))) | |
def init_theta(num_splits=4,num_actions=2): | |
""" Returns random [num_splits*num_splits,action_space] matrix of value action pairs """ |
This file contains 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
# Policy based reinforcement learning agent used to solve openai's CartPole challenge | |
# https://gym.openai.com/evaluations/eval_dMY1xQiST7GXe4Br5n31w | |
import numpy as np | |
import tensorflow as tf | |
import gym | |
ENVIRONMENT = "CartPole-v0" | |
SEED = 0 |
This file contains 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 | |
import gym | |
def evolve(W, sigma, prob_mutate=0.5): | |
rand = (np.random.randn(*W.shape) - 0.5) * sigma | |
mutate = np.random.choice([0,1],size=W.shape,p=(1-prob_mutate, prob_mutate)) | |
return W + (mutate * rand) | |
def evaluate(W, num_trials=1, max_t=1000, render=False): | |
cum_rewards = [] |
This file contains 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 gym | |
import numpy as np | |
from sklearn.preprocessing import StandardScaler | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout | |
from keras.optimizers import Adamax | |
# TD Learning | |
MEMORY = 1 # Number of prior states to consider when training our agent |
This file contains 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
class TicTacToe: | |
""" Tic-Tac Toe Board | |
Board is represented through a board object | |
1 ¦ 2 ¦ 3 | |
--+---+-- | |
4 ¦ 5 ¦ 6 | |
--+---+-- | |
7 ¦ 8 ¦ 9 |
OlderNewer