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
#' Randomly subsample a matrix or data frame. | |
#' | |
#' To randomly subsample, we are using the parametric option in the boot function | |
#' within the boot package. The 'parametric' option requires the specification of | |
#' a 'ran.gen' function to generate observations based on the original data and a list of | |
#' maximum likelihood estimators (MLE). We utilize this method, but instead of the | |
#' MLE, we instead pass the subsample_size. | |
#' | |
#' As noted in the boot documentation: Use of sim = "parametric" with a suitable ran.gen | |
#' allows the user to implement any types of nonparametric resampling which are not |
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
#!/bin/bash | |
# see: http://blog.tomtung.com/2009/11/cowsay-fortune | |
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed | |
# https://github.com/busyloop/lolcat | |
# https://github.com/dorentus/mruby-lolcat-bin | |
# | |
# requires `fortune`, `cowsay`, | |
# and ruby gem `lolcat` or its mruby version equivalent | |
export LANG="en_US.UTF-8" |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script type="text/javascript" src="js/typeahead.bundle.min.js"></script> |
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
create KEYSPACE spark_demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; | |
create table spark_demo.raw_files (filename text,line int, contents text, PRIMARY KEY(filename,line)); | |
create table spark_demo.users (id int PRIMARY KEY ); | |
create table spark_demo.movies (id int PRIMARY KEY, name text, year int); | |
create table spark_demo.ratings (id int PRIMARY KEY, user_id int, movie_id int, rating float ); |
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
# After Ubuntu 16.04, Systemd becomes the default. | |
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd | |
[Unit] | |
Description=Jupyter Notebook | |
[Service] | |
Type=simple | |
PIDFile=/run/jupyter.pid | |
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py |
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
#install keras from https://github.com/kundajelab/keras/tree/keras_1 | |
from __future__ import print_function | |
import keras | |
import numpy as np | |
np.random.seed(1) | |
#build a sample model | |
model = keras.models.Sequential() | |
model.add(keras.layers.convolutional.RevCompConv1D(input_shape=(100,4), | |
nb_filter=10, |
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
testvector <- c(.5, .1, .2, .9, .9, .2, .5) | |
# group rows based on cumsum with reset | |
cumsum_group <- function(x, threshold) { | |
cumsum <- 0 | |
group <- 1 | |
result <- numeric() | |
for (i in 1:length(x)) { | |
cumsum <- cumsum + x[i] |
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
#install keras from https://github.com/kundajelab/keras/tree/keras_1 | |
from __future__ import print_function | |
import keras | |
import numpy as np | |
np.random.seed(1) | |
#build a model | |
model = keras.models.Sequential() | |
model.add(keras.layers.convolutional.Convolution1D(input_shape=(1000,4), | |
nb_filter=300, |