Skip to content

Instantly share code, notes, and snippets.

View MGallow's full-sized avatar

Matt Galloway MGallow

View GitHub Profile
@MGallow
MGallow / SampleHomework.Rmd
Created August 23, 2016 23:28
sample homework templates for RMarkdown and R Sweave.
---
title: "R Markdown Homework Template"
author: "NAME HERE"
affiliation: "UNIVERSITY HERE"
abstract:
thanks:
keywords:
date: \today
output:
pdf_document:
@MGallow
MGallow / ImageNetClassifier.ipynb
Last active June 17, 2023 14:14
Simple ImageNet classifier using Keras and the Inception model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MGallow
MGallow / Slack.py
Created October 14, 2016 20:54
Let Slack notify you when your script is finished running!
# 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 / linear.R
Created May 19, 2017 17:53
weighted ridge regression script
## 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 / VGG.R
Created June 25, 2017 21:31
Keras in RStudio
## 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 / RandomForest.ipynb
Created March 4, 2018 16:47
Random forest from scratch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MGallow
MGallow / compute.R
Last active July 5, 2018 15:44
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.
## 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 / .travis.yml
Last active June 21, 2018 00:05
Build, check, AND deploy pkgdown site for R package with Travis
# 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: