Modified from:
Updated: 2016-07-27
# Based on tutorial from https://jeffbradberry.com/posts/2015/09/intro-to-monte-carlo-tree-search/ | |
# Author: Kyle Kastner | |
# License: BSD 3-Clause | |
from __future__ import print_function | |
import random | |
import copy | |
import numpy as np | |
import time | |
import argparse | |
import sys |
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat | |
# Originally seen at http://spatial.ly/2014/08/population-lines/ | |
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess, | |
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after | |
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line. | |
# The result of the code below can be seen at http://imgur.com/ob8c8ph | |
library(tidyverse) |
""" | |
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) |
Modified from:
Updated: 2016-07-27
require(grid) | |
require(scales) | |
require(reshape2) | |
# Notes: | |
# dat should be a 3 column data.frame with fields in order as per example below | |
# wave wavyness of curves defined in terms of x axis data range - experiment to get this right | |
# ygap gap between items on each y axis | |
# col a single colour or vector of colours for categories when listed in alphabetical order | |
# leg.mode if true legend plotted in largest data observation, otherwise custom coordinates (leg.x/y [0,1]) |
''' | |
Non-parametric computation of entropy and mutual-information | |
Adapted by G Varoquaux for code created by R Brette, itself | |
from several papers (see in the code). | |
This code is maintained at https://github.com/mutualinfo/mutual_info | |
Please download the latest code there, to have improvements and | |
bug fixes. |
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md)) | |
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md)) | |
all : $(SLIDES) $(HANDOUTS) | |
%.md.slides.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -o $@ | |
%.md.handout.pdf : %.md | |
pandoc $^ -t beamer --slide-level 2 -V handout -o $@ |
{%- extends 'full.tpl' -%} | |
{% block input_group -%} | |
<div class="input_hidden"> | |
{{ super() }} | |
</div> | |
{% endblock input_group %} | |
{%- block header -%} | |
{{ super() }} |
doInstall <- TRUE | |
toInstall <- c("ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
ANES <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANES.csv") | |
ANES <- ANES[ANES$year == 2008, -c(1, 11, 17)] # Limit to just 2008 respondents, | |
head(ANES) # remove some non-helpful variables | |
# Fit several models with the same DV: |