Commit 0a18f092 authored by Weigert, Andreas's avatar Weigert, Andreas
Browse files

changed folds to 10

added t.test example
parent bd968404
......@@ -62,6 +62,7 @@ household <- 8
plot(ts(smd[household,], frequency = 4*24),
main="Weekly load curve")
#plot the monday
plot(ts(smd[household,1:(24*4)], frequency = 4),
main="Load curves for each day")
......@@ -90,7 +91,7 @@ calcFeatures.smd <- function(SMD){
# define some times
weekday <- 1:(5*4*24)
weekend <- (5*4*24+1):672
night <- ( 1*4+1):( 6*4)
night <- ( 1*4+1):(6*4)
morning <- ( 6*4+1):(10*4)
noon <- (10*4+1):(14*4)
afternoon <- (14*4+1):(18*4)
......
......@@ -137,12 +137,15 @@ plot(performance(pred, "tpr", "fpr"))
```{r Classification with an advanced evaluation technique: cross-validation}
set.seed(1506)
all_data$crossfolds <- sample(1:5, nrow(all_data), replace = TRUE)
folds <- 10
all_data$crossfolds <- sample(1:folds, nrow(all_data), replace = TRUE)
# list for the interim results
results <- list()
for(foldIndex in 1:5){
for(foldIndex in 1:folds){
# creating data for the
testdata <- na.omit(all_data[all_data$crossfolds==foldIndex, c("pNumResidents2", selected.features)])
traindata <- na.omit(all_data[all_data$crossfolds!=foldIndex, c("pNumResidents2", selected.features)])
......@@ -183,5 +186,10 @@ auc_mean
#the ROC curve shows true-positive-rate vs. false-positive rate
plot(performance(pred, "tpr", "fpr"))
# Test if the AUCs are expexted to be greater than random (AUC=0.5)
t.test(auc_array, mu = 0.5, alternative = "greater")
```
......@@ -130,12 +130,15 @@ propabilities <- attributes(clres)$probabilities
```{r Classification with an advanced evaluation technique: cross-validation}
set.seed(1506)
all_data$crossfolds <- sample(1:5, nrow(all_data), replace = TRUE)
folds <- 10
all_data$crossfolds <- sample(1:folds, nrow(all_data), replace = TRUE)
# list for the interim results
results <- list()
for(foldIndex in 1:5){
for(foldIndex in 1:folds){
# creating data for the
testdata <- na.omit(all_data[all_data$crossfolds==foldIndex, c("pNumResidents2", selected.features)])
traindata <- na.omit(all_data[all_data$crossfolds!=foldIndex, c("pNumResidents2", selected.features)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment