Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
calculatePforWelchtTest = function(s) { | |
t.value = (s['mean', 'x'] - s['mean', 'y'] - 0) / | |
(sqrt(s['var', 'x']/s['#samples', 'x'] + | |
s['var', 'y']/s['#samples', 'y'] ) | |
) | |
r = (s['var', 'x']/s['#samples', 'x'] + | |
s['var', 'y']/s['#samples', 'y'] )^2 / | |
( (s['var', 'x']/s['#samples', 'x'])^2/(s['#samples', 'x']-1) + | |
(s['var', 'y']/s['#samples', 'y'])^2/(s['#samples', 'y']-1) |
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
#This function assumes that there is at least one hidden layer. | |
variableImportance = function(modelTf) { | |
numberOfWeights = c(dim(modelTf$weight$W1)[2], dim(modelTf$weight$W2)[2], dim(modelTf$weight$W2)[1]) | |
Qik = matrix(0, numberOfWeights[1], numberOfWeights[3]) | |
sumWj = array(0, numberOfWeights[2]); | |
sumWk = array(0, numberOfWeights[3]); | |
for(j in 1:numberOfWeights[2]){ | |
sumWj[j] = sum(abs(modelTf$weight$W1[,j])) |
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
public class MontyHall { | |
int usersChoice; | |
int doorWithTheCar; | |
} |
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
nuSVRGrid <- expand.grid( | |
gamma = c(0.0000305176, 0.000122070, 0.000488281, 0.00195313, 0.0078125, 0.03125, 0.125, 0.5, 2, 8, 32), | |
nu = c(0.01,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5, | |
0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0), | |
C = c(0.0000305176,0.000122070,0.000488281,0.00195313,0.0078125, | |
0.03125,0.125,0.5,2,8,32) | |
) | |
library(doParallel) | |
registerDoParallel(cores=10) |
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
modelInfo <- list(label = "nu-SVR with Radial Basis Function Kernel", | |
library = "e1071", | |
type = c("Regression"), | |
parameters = data.frame(parameter = c("nu", "C", "gamma"), | |
class = c("numeric", "numeric", "numeric"), | |
label = c("Nu", "Cost", "Gamma")), | |
loop = NULL, | |
grid=NULL, | |
fit = function(x, y, wts, param, lev, last, classProbs, ...) { | |
if(any(names(list(...)) == "prob.model") | is.numeric(y)) { |
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
trTest <- function(dataset, p = 0.75, scaleData='min-max', colsToBeScaled = c()) { | |
dataset[, 'train'] <- ifelse(runif(nrow(dataset)) <= p, 1, 0) | |
trData <- dataset[dataset[, 'train'] == 1,] | |
tData <- dataset[dataset[, 'train'] == 0,] | |
trData[,'train'] <- NULL | |
tData[,'train'] <- NULL | |
if(scaleData != FALSE) { |
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
crossValidation <- function(dataset, k = 10, scaleData='min-max', colsToBeScaled = c()) { | |
require(caret) | |
#create fold ids | |
folds <- createFolds(as.integer(row.names(dataset)), k = k) | |
folds <- lapply(folds, function(x) { | |
scaleData <- get('scaleData') | |
colsToBeScaled <- get('colsToBeScaled') | |
trData <- get('dataset')[-c(x), ] | |
tData <- get('dataset')[c(x), ] |