Skip to content

Instantly share code, notes, and snippets.

@fwhigh
fwhigh / gist:5602401
Created May 17, 2013 22:30
Example of solving an overdetermined system of linear equations in R. http://fwhigh.github.io/highonscience/2013/05/15/solve-a-system-of-linear-equations-in-R/
### Library
library(limSolve)
### Functions
# Make the matrix A from the puzzle data table
training.to.matrix.A <- function(train)
{
output<-matrix(nrow=nrow(train),ncol=10)
for (i in 1:nrow(train))
@fwhigh
fwhigh / 01_heights_weights_genders.csv
Created August 17, 2013 19:57
Plotting the separating line generated by a logistic regression in R.
Gender Height Weight
Male 73.847017017515 241.893563180437
Male 68.7819040458903 162.310472521300
Male 74.1101053917849 212.7408555565
Male 71.7309784033377 220.042470303077
Male 69.8817958611153 206.349800623871
Male 67.2530156878065 152.212155757083
Male 68.7850812516616 183.927888604031
Male 68.3485155115879 167.971110489509
Male 67.018949662883 175.92944039571
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fwhigh
fwhigh / auc_benchmark.sh
Last active June 5, 2017 05:47
Fast and Lean Ad Hoc Binary Classifier Evaluation
#!/usr/bin/env bash
for a in {1..3}; do perf -ROC < kddb.t_eval.subsample.txt &gt; /dev/null; done
time for a in {1..10}; do perf -ROC < kddb.t_eval.subsample.txt; done
# http://ryankuhn.net/blog/How-To-Use-Plotly-With-Jekyll
devtools::install_github("brendan-R/brocks")
@fwhigh
fwhigh / bootstrap.R
Last active June 16, 2017 21:01
The Streaming Distributed Bootstrap
library(data.table)
library(ggplot2)
thm <- theme_bw()
thm <- thm + theme(axis.line = element_line(colour = "black"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank())
@fwhigh
fwhigh / .gitignore
Last active July 10, 2017 15:19
Debiasing regularized regression
data
*~
@fwhigh
fwhigh / get_training_data.sh
Last active January 8, 2019 19:20
School of Data LA 2019: Predictive Models in Production
#!/usr/bin/env bash
mkdir -p data
cd data
wget https://archive.ics.uci.edu/ml/machine-learning-databases/00380/YouTube-Spam-Collection-v1.zip
unzip YouTube-Spam-Collection-v1.zip
@fwhigh
fwhigh / aicamp_recipe.sh
Last active October 14, 2021 17:46
Blog post: lightgbm-vs-keras-metaflow
# Make a directory you can blow away in full later
mkdir -p aicamp_demo && cd aicamp_demo
# Clone and pin the fwhigh/metaflow-helper git repo
git clone https://github.com/fwhigh/metaflow-helper.git
cd metaflow-helper
git checkout v0.0.1
# Set up and active a virtual environment
# Install the metaflow-helper package in editable model and dependencies
@fwhigh
fwhigh / filter_runs.py
Last active May 20, 2021 14:53
Blog post: Versioning Machine Learning Models with Metaflow Tags
from metaflow import Flow
def get_generate_data_run():
return Flow('GenerateData').latest_successful_run
def get_train_run(tags: list):
print(f'Retrieving run data with tags {tags}')
run_list = [