Skip to content

Instantly share code, notes, and snippets.

Matt Galloway MGallow

View GitHub Profile
@MGallow
MGallow / .travis.yml
Last active Jun 21, 2018
Build, check, AND deploy pkgdown site for R package with Travis
View .travis.yml
# Thanks to jtilly (https://github.com/jtilly/R-travis-container-example/blob/master/.travis.yml) for the inspiration... has since been slightly modified!
# Requires the generation of a GITHUB_TOKEN to allow Travis to access the repo. See here: https://bookdown.org/yihui/blogdown/travis-github.html
language: r
pandoc_version: 2.2.1
dist: trusty
sudo: false
branches:
only:
@MGallow
MGallow / compute.R
Last active Jul 5, 2018
Scripts to run a simulation study in parallel (with specified number of cores). Type "R CMD BATCH simulation.R &" in the terminal to execute. This simulation compares ridge and lasso regression estimators on data sets with various sample sizes, dimensions, and sparsity.
View compute.R
## Matt Galloway
## this file will be sent to each core
#---------------------------------------------------------------
# simulation parameters
# THESE MUST BE IDENTICAL IN BOTH FILES
reps = 50
N = 200
@MGallow
MGallow / RandomForest.ipynb
Created Mar 4, 2018
Random forest from scratch
View RandomForest.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MGallow
MGallow / VGG.R
Created Jun 25, 2017
Keras in RStudio
View VGG.R
## Simple example to create a VGG-like convolutional NN in R
## This requires the Keras library and a Tensorflow installation:
## https://rstudio.github.io/keras/index.html
##
## This tutorial was taken from: https://rstudio.github.io/keras/articles/sequential_model.html
library(keras)
# generate dummy data
@MGallow
MGallow / linear.R
Created May 19, 2017
weighted ridge regression script
View linear.R
## weighted ridge regression
linearr = function(X, y, lam = 0, weights = NULL, intercept = TRUE,
kernel = FALSE) {
# checks
n = dim(X)[1]
p = dim(X)[2]
if (is.null(weights)) {
@MGallow
MGallow / Slack.py
Created Oct 14, 2016
Let Slack notify you when your script is finished running!
View Slack.py
# This is a simple script that will allow Slack to notify you when your script is finished running.
# Specifically, you will receive a message that says: "Script Complete".
# But first, you need to generate a Slack token.
# See here: https://api.slack.com/tokens
from slacker import Slacker
Token = "PLACE TOKEN HERE"
@MGallow
MGallow / ImageNetClassifier.ipynb
Last active Sep 1, 2016
Simple ImageNet classifier using Keras and the Inception model
View ImageNetClassifier.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MGallow
MGallow / SampleHomework.Rmd
Created Aug 23, 2016
sample homework templates for RMarkdown and R Sweave.
View SampleHomework.Rmd
---
title: "R Markdown Homework Template"
author: "NAME HERE"
affiliation: "UNIVERSITY HERE"
abstract:
thanks:
keywords:
date: \today
output:
pdf_document:
You can’t perform that action at this time.