Skip to content

Instantly share code, notes, and snippets.

Avatar
🦏
Working from home

Ilya Orson IlyaOrson

🦏
Working from home
View GitHub Profile
@IlyaOrson
IlyaOrson / crp.jl
Created Mar 4, 2020
Chinese restaurant process
View crp.jl
"""
Generate table assignments for 'n' customers,
according to a Chinese Restaurant Process with dispersion parameter 'α'
Returns an array of integer table assignments
"""
function crp(n, α)
@assert n > 0
table_assignments = zeros(Int, n)
table_assignments[1] = 1 # first customer sits at table 1
@IlyaOrson
IlyaOrson / .block
Created Feb 7, 2019 — forked from mbostock/.block
Municipalities of Mexico II
View .block
border: no
height: 600
license: gpl-3.0
View local.py
"""Provides methods around syncing and usage of AWS s3 buckets as local caches rather than individually
downloading every file"""
import os
import shutil
import boto3 as boto
import multiprocessing
import copy
import hashlib
@IlyaOrson
IlyaOrson / setup_julia.sh
Created Dec 31, 2018 — forked from jiahao/setup_julia.sh
Setting up Julia on an Amazon EC2 instance
View setup_julia.sh
#Set up data partition
sudo mkdir /data
sudo chmod 777 /data
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab"
sudo mount /data
#Install build environment
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo
sudo yum -y update
sudo yum -y upgrade
@IlyaOrson
IlyaOrson / pg-pong.py
Created Oct 8, 2017 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
View pg-pong.py
""" 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
@IlyaOrson
IlyaOrson / edmonds.py
Created Jul 17, 2017 — forked from rogerhub/edmonds.py
An implementation of Edmond's Blossom Algorithm.
View edmonds.py
#!/usr/bin/env python
class Vertex:
def __init__(self, value):
self.value = value
self.edges = {}
def degree(self):
return len(self.edges)
def __str__(self):
return str(self.value)