Skip to content

Instantly share code, notes, and snippets.

View keithmgould's full-sized avatar

Keith Gould keithmgould

  • New York
View GitHub Profile
# toy example from https://www.kdnuggets.com/2017/04/simple-understand-gradient-descent-algorithm.html
import numpy as np
import random
import matplotlib.pyplot as plt
LEARNING_RATE_M = 1e-8
LEARNING_RATE_B = 1e-2
# sq ft , price
@keithmgould
keithmgould / log.txt
Created June 15, 2019 15:29
results of a run
0 - rwd:269.0, loss:-14.074104309082031
1 - rwd:206.0, loss:7.945431232452393
2 - rwd:236.0, loss:-2.8392391204833984
3 - rwd:228.75, loss:-41.76856231689453
4 - rwd:250.8, loss:-11.660385131835938
5 - rwd:231.5, loss:11.052635192871094
6 - rwd:217.14285714285714, loss:5.223728179931641
7 - rwd:214.5, loss:-6.977025985717773
8 - rwd:205.88888888888889, loss:-6.304763317108154
9 - rwd:207.5, loss:-2.8461992740631104
@keithmgould
keithmgould / failing_cod.py
Created April 22, 2019 19:59
failing code snippet for multiple models
import numpy as np
from keras.models import Sequential
from keras.callbacks import TensorBoard
from keras.layers import *
from keras.optimizers import *
N=10
INPUT_LEN = 4
OUTPUT_LEN = 2
# OpenGym MountainCar-v0
# -------------------
#
# This code demonstrates debugging of a basic Q-network (without target network)
# in an OpenGym MountainCar-v0 environment.
#
# Made as part of blog series Let's make a DQN, available at:
# https://jaromiru.com/2016/10/12/lets-make-a-dqn-debugging/
#
# author: Jaromir Janisch, 2016
@keithmgould
keithmgould / conda_love.txt
Last active September 27, 2018 21:17
Conda install packages
conda install -c anaconda numpy scipy pillow mpi4py
conda install -c conda-forge matplotlib
pip install tensorflow keras gym jupyter
@keithmgould
keithmgould / backlash.xml
Created June 30, 2018 02:57
Backlash Model
<?xml version="1.0"?>
<robot name="bot">
<!-- colors ................................................................. -->
<material name="red">
<color rgba="0.8 0 0 1"/>
</material>
<material name="green">
<color rgba="0 0.8 0 0.75"/>
@keithmgould
keithmgould / .gitconfig
Created March 28, 2018 17:06
little git config file for raspberry pi
[user]
name = Keith Gould
email = keithmgould@gmail.com
[core]
excludesfile = ~/.gitignore_global
[credential]
helper = osxkeychain
[alias]
b = branch
c = commit
@keithmgould
keithmgould / .vimrc
Created March 28, 2018 16:56
raspberry pi vimrc
"------------------------------------
" Look and Feel
"------------------------------------
set guifont=Monaco:h11
set background=dark
" show line numbers
set number
set ruler
@keithmgould
keithmgould / episodic_reinforce.py
Created February 6, 2018 19:16
REINFORCE Episodic Batch Version
import pdb
import gym
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.python.ops import random_ops
def _initializer(shape, dtype=tf.float32, partition_info=None):
return random_ops.random_normal(shape)
import numpy as np
import datetime
import tensorflow as tf
class Policy():
def __init__(self, session):
self.session = session
self.actions = tf.placeholder(tf.float32)
self.advantages = tf.placeholder(tf.float32)
self.observations = tf.placeholder(tf.float32, shape=[None, 4])