-
Notifications
You must be signed in to change notification settings - Fork 0
/
friedman_nemenyi.R
62 lines (51 loc) · 1.64 KB
/
friedman_nemenyi.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
library(knitr)
library(scmamp)
library(readr)
reportFriedmana <- function(averages, metricName, make_plot = F){
ranks <- t(apply(-averages, 1, rank))
ranks <- ranks[,order(colMeans(ranks, na.rm=TRUE))]
cat("<hr><strong>Friedman rank sum test</strong><br />")
testResult <- capture.output(print(friedman.test( data.matrix(averages))))
cat(testResult[5])
cat("\r\n")
print(kable(t(colMeans(ranks, na.rm=TRUE)), digits = 2))
cat("\r\n")
if (make_plot){
if (SAVE_EPS) {
setEPS()
postscript(paste0(metricName, "_", "Friedman.eps"), width = 7, height = 3.4)
plot = tryCatch({
plotCD(results.matrix = averages, alpha = 0.05, cex = 1.1)
}, error = function(e) {
return(last_plot())
})
dev.off()
}
plot = tryCatch({
plotCD(results.matrix = averages, alpha = 0.05)
}, error = function(e) {
return(last_plot())
})
plot
}
cat("<hr>")
}
data <- read_csv("/home/dhorna/dev/studies/mgr/mgr-repo/results_csv/f1_knn.csv")
#View(data)
# Remove dataset column from data
averages <- data[-1]
#averages
ranks <- t(apply(-averages, 1, rank))
ranks <- ranks[,order(colMeans(ranks, na.rm=TRUE))]
rowMeans(t(ranks))
sort(rowMeans(t(ranks)))
SAVE_EPS=T
# Removing cleveland_v2
averages = averages[-12,]
reportFriedmana(averages, "KNN_f", make_plot = F)
pvalues_vec <- c(wilcox.test(averages$`New Rep.`,averages$Baseline, paired=T)$p.value,
wilcox.test(averages$`New Rep.`,averages$`Global-CS`, paired=T)$p.value,
wilcox.test(averages$`New Rep.`,averages$`Static-SMOTE`, paired=T)$p.value,
wilcox.test(averages$`New Rep.`,averages$MDO, paired=T)$p.value
)
pvalues_vec