Skip to content

Instantly share code, notes, and snippets.

@lirnli
lirnli / CartPole-v0 Q-learning.py
Last active August 13, 2017 00:26
CartPole-v0 Q-learning
## A simple Q-learning net with memory relay
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
import gym
# Get env parameters
GYM_NAME = 'CartPole-v0'
env = gym.make(GYM_NAME)
obs_shape = env.observation_space.shape
@lirnli
lirnli / MountainCar-v0 Double Deep Q Net.py
Last active August 17, 2017 16:11
MountainCar-v0 Double Deep Q Net
# Two Q nets are used. They use themsevleves to estimate Q(t,a) but use the other to estimate argmax Q(t+1,a).
# Still use one-step algorithm in training Q nets.
# Based on arXiv:1509.06461 [cs.LG]
# https://lirnli.wordpress.com/2017/08/17/debugging-reinforcement-neural-network-deep-q-net/
#
# Hyperparameter summary:
# reward decay rate = 0.999
# memory relay (with 10000 observations)
# AdamOptimizer, with learning rate decay
# tanh activation function
@lirnli
lirnli / Copy-v0 Deep Q learn.ipynb
Last active August 27, 2017 04:51
Simple Deep Q learn for Copy-v0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lirnli
lirnli / A vanilla recurrent neural net implementation with Tensorflow.ipynb
Last active August 28, 2017 05:36
A vanilla recurrent neural net implementation with Tensorflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lirnli
lirnli / Pytorch RNN.ipynb
Last active October 17, 2020 07:19
Pytorch RNN examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lirnli
lirnli / Variational MNIST classification.ipynb
Last active September 14, 2017 22:45
Variational MNIST classification
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lirnli
lirnli / tiny Shakespeare.ipynb
Created September 17, 2017 10:59
tiny Shakespeare
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.