Skip to content

Instantly share code, notes, and snippets.

Aaron Schumacher ajschumacher

Block or report user

Report or block ajschumacher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lid_mle.py
import random
import math
def mean(elements):
return sum(elements) / len(elements)
def euclidean_dist(first, second):
assert len(first) == len(second)
return sum((f - s)**2 for f, s in zip(first, second))**0.5
@ajschumacher
ajschumacher / mspacman.py
Created Jan 12, 2017
play Ms. Pacman w/ OpenAI gym
View mspacman.py
import time
import pygame
import gym
frame_time = 1.0 / 15 # seconds
pygame.init()
View tensorflow.py
import tensorflow as tf
w = tf.Variable([2.0])
b = tf.Variable([2.0])
x = tf.constant([1.0])
y = tf.sigmoid(w*x + b)
y_ = tf.constant([0.0])
cross_entropy = -1*(y_*tf.log(y) + (1-y_)*(tf.log(1-y)))
s = tf.Session()
s.run(tf.initialize_all_variables())
@ajschumacher
ajschumacher / README.md
Last active Oct 17, 2018 — forked from mbostock/.block
Interactive D3 view of sklearn decision tree
View README.md
@ajschumacher
ajschumacher / getch.py
Created May 11, 2015
get one character at a time at the console with python
View getch.py
def _find_getch():
# courtesy of Louis
# http://stackoverflow.com/questions/510357/
try:
import termios
except ImportError:
# Non-POSIX. Return msvcrt's (Windows') getch.
import msvcrt
return msvcrt.getch
@ajschumacher
ajschumacher / test.rst
Last active Jan 19, 2017
github fails to render rst email links properly
View test.rst
@ajschumacher
ajschumacher / build_logins.sh
Last active Mar 6, 2018 — forked from JoshData/build_logins.sh
script for making users for multi-user RStudio
View build_logins.sh
#!/bin/bash
# Start an AWS instance with one of the AMIs provided by:
# http://www.louisaslett.com/RStudio_AMI/
#
# Get this script and make executable.
# wget THE_RAW_URL
# chmod +x build_logins.sh
#
# Then use this script to create many logins on the system.
@ajschumacher
ajschumacher / scoring.R
Created Aug 17, 2014
code for a blog post on Wilson scoring vs. Laplace smoothing
View scoring.R
par(pty='s')
par(mfrow=c(1, 2))
ci_lower_bound <- function(pos, n, confidence) {
if (n == 0) return(0)
z = qnorm(1 - (1 - confidence) / 2)
p = pos / n
(p + z^2 / (2*n) - z * sqrt((p * (1-p) + z^2 / (4*n)) / n )) /
(1 + z^2 / n)
View longest_ordered.R
longest.ordered <- function(original) {
results <- list()
for (item in original) {
static_results <- results
for (stem in static_results) {
if (stem[length(stem)] <= item) {
results[[length(results)+1]] <- c(stem, item)
}
}
results[[length(results)+1]] <- item
You can’t perform that action at this time.