-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindicesTest.R
60 lines (44 loc) · 1.3 KB
/
indicesTest.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
source('autoload.R')
#initialize formulas list
trSplitSeeds <- 1:50
## initialize result data frame
result <- data.frame(
gender=character(),
seed=numeric(),
method=character(),
fm=character(),
RMSE=numeric(),
MAPE=numeric(),
RSquared=numeric(),
Spearman=numeric()
)
methods <- bfpCols[-1]
trControlSeeds <- getTrControlSeeds()
for(genderDbID in names(genderDb)) {
#length is = (n_repeats*nresampling)+1
for(trSplitSeed in trSplitSeeds) {
set.seed(trSplitSeed)
tt <- trTest(genderDb[[genderDbID]], p=.7)
for(method in methods) {
cat(paste('Gender:', genderDbID, 'Training:', method, "\n"))
truth <- tt$test$DEXAyagyuz
predicted <- tt$test[, method]
error <- truth - predicted
curResult <- data.frame(
gender=genderDbID,
seed=trSplitSeed,
method=method,
fm='',
RMSE=rmse(error),
MAPE=mape(truth, predicted),
RSquared=rSquared(truth, predicted),
Spearman=rcorr(truth, predicted, type="spearman")$r[1,2],
MAE=mae(error)
)
result <- rbind(result, curResult)
print(curResult)
}
}
}
#AIzaSyCiAm3UjbsLzqIroncItsjnHeV61GVmMz0
save(result, file='indicesResults.RData')