Skip to content

Instantly share code, notes, and snippets.

View traversc's full-sized avatar

Travers traversc

View GitHub Profile
@traversc
traversc / altrepstring.cpp
Last active January 15, 2019 17:50
alt rep string test
#include <iostream>
#include "altrepisode.h"
#include <string>
#include <vector>
std::string getRandomStrings(int seed, int len = 30) {
std::srand(static_cast<unsigned int>(seed));
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@traversc
traversc / fastAUC.r
Last active April 12, 2021 09:31
Fast AUC and ROC calculations in R
fastROC <- function(probs, class) {
class_sorted <- class[order(probs, decreasing=T)]
TPR <- cumsum(class_sorted) / sum(class)
FPR <- cumsum(class_sorted == 0) / sum(class == 0)
return(list(tpr=TPR, fpr=FPR))
}
# Helpful function adapted from: https://stat.ethz.ch/pipermail/r-help/2005-September/079872.html
fastAUC <- function(probs, class) {
x <- probs