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
# Load libraries | |
library(ggplot2) | |
library(stringr) | |
library(scales) | |
library(ggthemes) | |
library(PerformanceAnalytics) | |
library(RColorBrewer) | |
# The URL for the data | |
url.name <- "http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp" |
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
# Load libraries | |
library(ggplot2) | |
library(stringr) | |
library(scales) | |
library(ggthemes) | |
library(PerformanceAnalytics) | |
library(RColorBrewer) | |
# The URL for the data | |
url.name <- "http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp" |
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
library(plyr) | |
data <- read.table("rdata-10pct-1973-1999.dat",sep = " ", header = TRUE, na.strings="NULL", | |
colClasses=c(DATE="character",GVKEY="character",MONTH="character")) | |
x <- data[1:6] | |
y <- factor(data$LABEL) | |
preds.train <- predict(mdl,x) | |
data$preds <- as.numeric(levels(preds.train))[preds.train] |
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
library(ggplot2) | |
library(mlbench) | |
data(PimaIndiansDiabetes) | |
p <- ggplot( PimaIndiansDiabetes, | |
aes( x=glucose, fill=diabetes))+ | |
geom_histogram(alpha=0.4,position="identity")+ | |
xlab("diabetes")+ | |
scale_y_continuous("Number of Observations") |
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
library(ggplot2) | |
library(mlbench) | |
data( PimaIndiansDiabetes ) | |
ggplot( PimaIndiansDiabetes, aes( x=glucose, y=..density..))+ | |
geom_histogram(fill="cornsilk",colour="grey60",size=0.2)+geom_density()+facet_grid( diabetes ~ . ) | |
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
require(mlbench) | |
require(rgl) | |
require(MASS) | |
require(plot3D) | |
##' diverging colour palette function with set midpoint | |
##' | |
##' returns a palette function that maps values to colours, with | |
##' a midpoint (defaulting to 0) corresponding to the central colour | |
##' @title diverging_palette |
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
library(caret) | |
library(C50) | |
library(mlbench) | |
C5CustomSort <- function(x) { | |
x$model <- factor(as.character(x$model), levels = c("rules","tree")) | |
x[order(x$trials, x$model, x$splits, !x$winnow),] | |
} |
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
library(caret) | |
library(C50) | |
library(mlbench) | |
fitControl <- trainControl(method = "repeatedcv", | |
number = 10, | |
repeats = 10, returnResamp="all") | |
# Choose the features and classes | |
data(PimaIndiansDiabetes2) |
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
'use strict'; | |
/////////////////////////////////////////////////// | |
// DB Connection setup and utils | |
/////////////////////////////////////////////////// | |
var mongodb = require('mongodb'); | |
var software = require('./package.json'); | |
var env = require('./env')( ); |
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
#!/usr/local/bin/perl -w | |
# This script is intended to be run as a cron job every n-minutes | |
# Or whatever the equiv is on windows | |
use strict; | |
use MongoDB; | |
use MongoDB::OID; | |
use POSIX qw(strftime); |