Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
eesys-public
BIA-Resources
Commits
0a18f092
Commit
0a18f092
authored
Jan 09, 2020
by
Weigert, Andreas
Browse files
changed folds to 10
added t.test example
parent
bd968404
Changes
3
Hide whitespace changes
Inline
Side-by-side
Tutorial_Scripts/Case_EnergyRetailAnalytics/BIA_T09_Classification.Rmd
View file @
0a18f092
...
...
@@ -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
)
...
...
Tutorial_Scripts/Case_EnergyRetailAnalytics/BIA_T10_Classification2.Rmd
View file @
0a18f092
...
...
@@ -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")
```
Tutorial_Scripts/Case_EnergyRetailAnalytics/BIA_T10_Classification2_exercise.Rmd
View file @
0a18f092
...
...
@@ -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)])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment