This file contains hidden or 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
#!/bin/python | |
''' | |
Usage: | |
python downsample.py [offset+]amount | |
Examples: | |
cat super_big.csv | python downsample.py 1+4 > big_divided_by_4.csv | |
cat data.csv | python downsample.py 2 > data_halved.csv | |
''' |
This file contains hidden or 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/env python | |
""" | |
Example of using Keras to implement a 1D convolutional neural network (CNN) for timeseries prediction. | |
""" | |
from __future__ import print_function, division | |
import numpy as np | |
from keras.layers import Convolution1D, Dense, MaxPooling1D, Flatten | |
from keras.models import Sequential |
This file contains hidden or 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
# R code to produce a simulated dataset for an experiment on a made up insect. | |
# Measures include sex, body length, thorax width, number of thoracic bristles and some measure of aggression behaviour. | |
# Also there is exposure to some treatment stimulus/drug. | |
# This simulation uses Copulas to generate correlated variables from binomial, Gaussian and Poisson distributions | |
require(copula) | |
set.seed(1888) | |
n <- 1000 |
This file contains hidden or 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
""" 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 |
This file contains hidden or 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
#How to download streaming video | |
Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood. | |
##Open Developer Tools | |
From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either: | |
1. (On a mac): Command-option-J | |
2. (On a PC): Control-alt-J |
This file contains hidden or 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 numpy as np | |
from keras.datasets import imdb | |
from keras.preprocessing.sequence import pad_sequences | |
from keras.models import Sequential | |
from keras.layers import containers | |
from keras.layers.noise import GaussianNoise | |
from keras.layers.core import Dense, AutoEncoder | |
from keras.utils import np_utils | |
from sklearn.metrics import (precision_score, recall_score, |
This file contains hidden or 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 numpy | |
from scipy.ndimage.interpolation import map_coordinates | |
from scipy.ndimage.filters import gaussian_filter | |
def elastic_transform(image, alpha, sigma, random_state=None): | |
"""Elastic deformation of images as described in [Simard2003]_. | |
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for | |
Convolutional Neural Networks applied to Visual Document Analysis", in |
This file contains hidden or 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
# original example from Digg Data website (Takashi J. OZAKI, Ph. D.) | |
# http://diggdata.in/post/58333540883/k-fold-cross-validation-in-r | |
library(plyr) | |
library(randomForest) | |
data <- iris | |
# in this cross validation example, we use the iris data set to |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
NewerOlder