Skip to content

Instantly share code, notes, and snippets.

View justheuristic's full-sized avatar
💭
on github.com/learning-at-home

justheuristic justheuristic

💭
on github.com/learning-at-home
View GitHub Profile
@jterrace
jterrace / xvfb
Created June 11, 2012 18:46
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@ParkinT
ParkinT / Collatz Random Number.md
Created August 12, 2012 16:44
Random Number generator using Collatz Conjecture

When I first uncovered Collatz conjecture it made perfect sense to me. You are simply dividing an even number in half until you reach one and, if the number is not even you coerce it to be so.

This created a flash of inspiration for me to devise this simple routine.

{This could be used as the basis of a program to prove the "unsolved problem" of whether Collatz conjecture applies to ALL numbers greater than one.}

# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@julionc
julionc / 00.howto_install_phantomjs.md
Last active November 6, 2024 15:45
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@joschu
joschu / 1-trpo-gae-v0-writeup.md
Last active April 20, 2024 17:30
TRPO-GAE (Version 0) Writeup

Code used to obtain these results can be found at the url https://github.com/joschu/modular_rl, commit 50cdfdf375e69d86e3db6eb2ad0218ea6aebf371. The command line expression used for all the environments can be found in the text file below. Note that the same exact parameters and policies were used for all tasks, except for timesteps_per_batch, which was varied based on the difficulty of the task. The important parameters are:

  • gamma=0.995: discount
  • lam=0.97: see GAE paper for explanation
  • agent=TrpoAgent: name of the class, which specifies policy and value function architecture. In this case, we used two hidden layers of size 64, with tanh activations
  • cg_damping: multiple of the identity added for conjugate gradient
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@sorenbouma
sorenbouma / cem.py
Last active April 17, 2018 05:54
This is a basic python implementation of the Cross-Entropy Method for reinforcement learning on OpenAI gym's CartPole environment.
import gym
import numpy as np
import matplotlib.pyplot as plt
env = gym.make('CartPole-v0')
env.render(close=True)
#vector of means(mu) and standard dev(sigma) for each paramater
mu=np.random.uniform(size=state.shape)
sigma=np.random.uniform(low=0.001,size=state.shape)
@ferrine
ferrine / bayes.py
Created August 3, 2016 22:35
bayes by backprop wrapping
import math
from functools import wraps
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from lasagne import init
from lasagne.random import get_rng
__all__ = ['Accumulator', 'NormalApproximation', 'NormalApproximationScMix', 'bbpwrap']
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlee-gk
alexlee-gk / locally_connected2d.py
Last active October 17, 2016 11:25
Locally connected 2D layer using Lasagne and Theano
import numpy as np
import theano
import theano.tensor as T
import lasagne.layers as L
class LocallyConnected2DLayer(L.Conv2DLayer):
"""Similar to Conv2DLayer except that the filter weights are unshared
This implementation computes the output tensor by iterating over the filter