Skip to content

Instantly share code, notes, and snippets.

@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@karpathy
karpathy / min-char-rnn.py
Last active April 26, 2025 16:14
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@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
import math
import random
def get_random_neighbour(state):
neighbour = [house[:] for house in state] # Deep copy
i, j = random.sample(xrange(5), 2)
attr_idx = random.randint(0, 4)
neighbour[i][attr_idx], neighbour[j][attr_idx] = neighbour[j][attr_idx], neighbour[i][attr_idx]
@rahimnathwani
rahimnathwani / gce-create.sh
Created March 20, 2017 12:09
Create GPU instance on Google Cloud, for course.fast.ai
gcloud beta compute instances create gpu-instance-1 \
--machine-type n1-standard-1 --zone asia-east1-a \
--accelerator type=nvidia-tesla-k80,count=1 \
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \
--maintenance-policy TERMINATE --no-restart-on-failure \
--boot-disk-size=25GB
@rahimnathwani
rahimnathwani / gce-create-from-snapshot.sh
Created March 20, 2017 12:11
Create GPU instance from previously-create snapshot
gcloud compute snapshots list
gcloud compute disks create deep-learning-persistent-disk-1 --size=25GB --source-snapshot=deep-learning-snapshot-1
gcloud beta compute instances create gpu-instance-1 \
--machine-type n1-standard-1 --zone asia-east1-a \
--accelerator type=nvidia-tesla-k80,count=1 \
--image-family ubuntu-1604-lts --image-project ubuntu-os-cloud \
--maintenance-policy TERMINATE --no-restart-on-failure \
--disk=auto-delete=yes,boot=yes,name=deep-learning-persistent-disk-1
gcloud compute instances add-tags gpu-instance-1 --tags https-server
@rahimnathwani
rahimnathwani / install-gpu-gce.sh
Last active August 4, 2017 19:28
Set up a Google Cloud GPU instance for doing the exercises in course.fast.ai
#!/bin/bash
if ! dpkg-query -W cuda; then
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
fi
apt-get update
apt-get -y upgrade
apt-get -y install tmux build-essential gcc g++ make binutils software-properties-common cuda unzip
modprobe nvidia
nvidia-smi
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.
library(tidyverse)
# Download Fira Sans Condensed from
# https://fonts.google.com/specimen/Fira+Sans+Condensed
high_mean <- 12
high_sd <- 4
flat_mean <- 35
flat_sd <- 12