Skip to content

Instantly share code, notes, and snippets.

@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
@azymnis
azymnis / ItemSimilarity.scala
Created December 13, 2013 05:17
Approximate item similarity using LSH in Scalding.
import com.twitter.scalding._
import com.twitter.algebird.{ MinHasher, MinHasher32, MinHashSignature }
/**
* Computes similar items (with a string itemId), based on approximate
* Jaccard similarity, using LSH.
*
* Assumes an input data TSV file of the following format:
*
* itemId userId
@leostratus
leostratus / AI-CogSci-Reading-List-RobotsConf-2013
Created December 7, 2013 17:50
This is an AI/Cognitive Science reading list from discussions at RobotsConf 2013. Please add to this list in the comments. Bonus point if all y'all keep 'em in chronological order. I'll update the master list later today! (Saturday December 7th 2013) Format: { Title } { Year_of_Publication } { Amazon_Link } { Short_Description}
How to Create a Mind
2013
http://www.amazon.com/How-Create-Mind-Thought-Revealed/dp/0143124048/
Great pop-cogsci book on Kurzweil's pattern recognition theory of mind. AI concepts such as hierarchal-hidden-markov-models and neural nets are discussed.
---
Consciousness: An Introduction
2003
http://www.amazon.com/Consciousness-Introduction-Susan-Blackmore/dp/019515343X/
@jdegoes
jdegoes / DataScienceInScala.scala
Created February 8, 2013 15:11
Example code for the Creating a Data Science Platform in Scala talk.
object BenchmarkCommon {
import scala.util.Random
val DatasetSize = 10000
val Iterations = 10000
val ArrayPoolSize = 1000
val ArrayPool = {
def randomArray(): Array[Int] = {
val array = new Array[Int](DatasetSize)
@MattiSG
MattiSG / brewv
Created July 9, 2012 14:05
Install a previous version of a formula with Homebrew
#!/bin/bash
#
# Installs the previous version of a Homebrew formula
#
# Usage: brewv formula_name desired_version
#
# Based on http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula#9832084
#
# Author: Matti Schneider <hi@mattischneider.fr> (http://mattischneider.fr)