Skip to content

Instantly share code, notes, and snippets.

View nicolehe's full-sized avatar

Nicole He nicolehe

View GitHub Profile
@nicolehe
nicolehe / index.html
Last active February 1, 2017 19:05
nicole.pizza/itp/hacking-the-browser/relax
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>relax :)</title>
<script type="text/javascript">
var image = 0;
var background = ['0.jpg', '1.jpg', '2.jpg', '3.jpg', '4.jpg'];
@nicolehe
nicolehe / _mlp_income.py
Last active October 31, 2016 16:28
predicting whether or not someone makes more than $50k or less than $50k: http://archive.ics.uci.edu/ml/datasets/Adult
#!/usr/bin/python
# Learning Machines
# Taught by Patrick Hebron at NYU ITP
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
# np.set_printoptions(threshold=np.nan)
@nicolehe
nicolehe / mlp.py
Created October 24, 2016 04:06
mlp attempt, unfinished
import numpy as np
class MultilayerPerceptron():
'making a multilayer preceptron'
def __init__(self, sample_size, hidden_size, output_size, hidden_layers, total_epochs, learning_rate, report_freq):
self.sample_size = sample_size
self.hidden_size = hidden_size
self.output_size = output_size
self.hidden_layers = hidden_layers
@nicolehe
nicolehe / _recommender.py
Created September 26, 2016 03:49
simple python recommendation engine
import numpy as np
import sys
from data import critics as people
# euclidian distance method:
# get the shared items between each person, and then find the distance
def similarity(person1, person2):
# if they share a rated item, add it to the shared list
shared = [item for item in people[person1] if item in people[person2]]
@nicolehe
nicolehe / _traceroute-commute.html
Last active September 19, 2016 03:52
traceroute commute
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Baloo+Bhaina" />
<title>Directly accessing Street View data</title>
<style>
html,
@nicolehe
nicolehe / run_length.py
Created September 18, 2016 15:55
run length encoder and decoder
import sys
# split the input string into a list of characters
input_split = list(sys.argv[1])
def encode(i):
result = list() # storing the result in a list of tuples
previous = None # for the first letter, the 'previous' character is null
matches = 0 # no matches to begin with
for letter in i: # for each letter in the input...
@nicolehe
nicolehe / index.html
Created April 21, 2016 14:12
index.js
d3.csv('/claims-data-2015.csv', function(data) {
var claimsDataByAirline = _.groupBy(data, 'Airline Name');
//console.log(claimsDataByAirline);
var eachClaimByAirline = {};
_.each(claimsDataByAirline, function(claimsDataForOneAirline, airline) {
@nicolehe
nicolehe / index.html
Created April 14, 2016 02:29
cheaters by religiousness
<!DOCTYPE html>
<html>
<head>
<title>cheaters by religiousness - by nicole he</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href='https://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
</head>
<body>
import os
import random
import json
import urlsutils
# path for the folder that has all the files
path = "/Users/nicolehe/Desktop/ITP/Spring-2016/rwet/midterm/"
for i in range(5): #this makes it run 5 times
import sys
import urllib
import json
import random
from nltk.tokenize import sent_tokenize, word_tokenize
pet_params = {
'format': 'json',
'output': 'full',