Previous changeset 47:7b9b78352811 (2016-10-26) Next changeset 49:6d6b76131103 (2016-10-26) |
Commit message:
Uploaded |
modified:
aggregation.R |
b |
diff -r 7b9b78352811 -r cea4a54c52d0 aggregation.R --- a/aggregation.R Wed Oct 26 02:33:15 2016 -0400 +++ b/aggregation.R Wed Oct 26 17:31:45 2016 -0400 |
b |
@@ -12,9 +12,20 @@ suppressWarnings(suppressMessages(library(randomForest))) library(e1071) suppressWarnings(suppressMessages(library(glmnet))) +options(warn=-1) ############################ helper functions ####################### ##### Genetic algorithm + +# compute r2 by computing the classic formula +# compare the sum of square difference from target to prediciton +# to the sum of square difference from target to the mean of the target +r2 <- function(target, prediction) { + sst <- sum((target-mean(target))^2) + ssr <- sum((target-prediction)^2) + return(1-ssr/sst) +} + optimizeOneIndividual <- function(values, trueValue) { # change the value into a function f <- function(w) {sum(values * w/sum(w))} @@ -282,7 +293,7 @@ out = out, prediction = prediction, model=model) }, lasso={ - aggregateLASSO(classifiers = classifPrediction, target = phenotype, + aggregateLASSO(classifiers = data.matrix(classifPrediction), target = phenotype, out = out, prediction = prediction, model=model) }, rf={ |