-
Notifications
You must be signed in to change notification settings - Fork 24
/
test1.R
97 lines (77 loc) · 3.09 KB
/
test1.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
getSVDImpute = function(x) {
k = 10
num.iters = 10
verbose = F
SVDImpute(x, k = k, num.iters = num.iters, verbose=F)$x
}
getRobustSVDImpute = function(x) {
k = 3
alpha = 1
max.iters = 3
robustSVDImpute(x, k = k, alpha = alpha, max.iters = max.iters)$x
}
getSVTImpute = function(x) {
SVTImpute(x, lambda = 0.1, verbose=F)$x
}
getKNNImpute = function(x) {
kNNImpute(x, k = 3, verbose = F)$x
}
getgbmImpute = function(x) {
gbmImpute(x, max.iters = 1, verbose = T)$x
}
getMeanImpute = function(x) {
meanImpute(x)$x
}
getLmImpute = function(x) {
lmImpute(x)$x
}
#RANDOM DATA IMPUTATION
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getSVDImpute,
numRow = 1000, numCol = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getRobustSVDImpute,
numRow = 1000, numCol = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getSVTImpute,
numRow = 1000, numCol = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getKNNImpute,
numRow = 5000, numCol = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getgbmImpute,
numRow = 1000, numCol = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.random(imputation.fn = getMeanImpute,
numRow = 1000, numCol = 10,
numMissing = 500))
#TIME SERIES IMPUTATION
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getSVDImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getRobustSVDImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getSVTImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getKNNImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getgbmImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))
set.seed(100)
system.time(imputation.benchmark.ts(imputation.fn = getMeanImpute,
numTS = 1000, TSlength = 10,
numMissing = 500))