This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tableau 10 color theme | |
$themes: ( | |
blue: #5778a4, | |
orange: #e49444, | |
red: #d1615d, | |
teal: #85b6b2, | |
green: #6a9f58, | |
yellow: #e7ca60, | |
purple: #a87c9f, | |
pink: #f1a2a9, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import sklearn.linear_model | |
from mpl_toolkits.mplot3d import Axes3D | |
X_train = np.random.rand(2000).reshape(1000,2)*60 | |
y_train = (X_train[:, 0]**2)+(X_train[:, 1]**2) | |
X_test = np.random.rand(200).reshape(100,2)*60 | |
y_test = (X_test[:, 0]**2)+(X_test[:, 1]**2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import colorsys | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
%matplotlib inline | |
def alter(alist, col, factor=1.1): | |
tmp = np.array(alist) | |
tmp[:,col] = tmp[:,col] * factor | |
tmp[tmp > 1] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# Copyright (C) 2016 Sixten Bergman | |
# License WTFPL | |
# | |
# This program is free software. It comes without any warranty, to the extent | |
# permitted by applicable law. | |
# You can redistribute it and/or modify it under the terms of the Do What The | |
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See |