-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.Rnw
191 lines (146 loc) · 5.84 KB
/
report.Rnw
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
\documentclass{article}
\usepackage[left=0.75in,top=0.65in,right=0.75in,bottom=0.55in]{geometry}
\begin{document}
\author{Ilya Verenich}
<<include=FALSE>>=
library(knitr)
opts_chunk$set(
concordance=TRUE
)
@
\title{Calculation of processing and overprocessing}
\date{}
\maketitle
\begin{equation}
\widetilde{W_\sigma}=
\sum_{i=1}^{N} ( P_i^r \cdot \prod_{k=1}^{i-1} (1 - P_k^r) \cdot (\sum_{j=1}^{i} E_j) )
\label{eq:estim-overproc}
\end{equation}
<<echo=FALSE, results='hide'>>=
library(ggplot2)
library(reshape)
opts_knit$set(root.dir = "output/")
@
\section{For Bondora log}
<<echo=FALSE, results='hide'>>=
filenames <- list.files()[grep(paste("^output_Bondora(?=.*\\.csv)",sep=''), list.files(), perl=TRUE)]
dat = c()
result = matrix(0,nrow = length(filenames),ncol = 6)
colnames(result) = c("nr_checks_our","nr_checks_Wil","nr_checks_rand",
"overproc_our","overproc_Wil","overproc_rand")
for (i in 1:length(filenames)) {
foo = read.table(filenames[i],sep=",",header=TRUE)
dat = rbind(dat,foo)
result[i,1] = mean(foo$nr_checks_our)
result[i,2] = mean(foo$nr_checks_Wil)
result[i,3] = mean(foo$nr_checks_rand)
result[i,4] = mean(foo$nr_checks_our - foo$minimum_check_number)
result[i,5] = mean(foo$nr_checks_Wil - foo$minimum_check_number)
result[i,6] = mean(foo$nr_checks_rand - foo$minimum_check_number)
}
@
Minimal possible number of checks, averaged over \Sexpr{length(filenames)} test sets :
<<>>=
round(sum(dat$minimum_check_number)/length(filenames))
@
Average number of checks per test set that one would do if they follow \textbf{our ordering}:
<<>>=
round(sum(dat$nr_checks_our)/length(filenames))
@
Average number of checks that one would do if they apply \textbf{Wil's method} (constant reject probabilities):
<<>>=
round(sum(dat$nr_checks_Wil)/length(filenames))
@
Average number of checks that one would do if for every case they do checks in \textbf{random order}
<<>>=
round(sum(dat$nr_checks_rand)/length(filenames))
@
Average overprocessing (in \%) with our ordering:
<<>>=
round(100*(sum(dat$nr_checks_our) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
Average overprocessing with Wil ordering:
<<>>=
round(100*(sum(dat$nr_checks_Wil) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
Average overprocessing with random ordering:
<<>>=
round(100*(sum(dat$nr_checks_rand) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
\textbf{Distribution of the number of checks performed}
<<echo=FALSE, results='hide'>>=
tt = matrix(0,nrow = 4,ncol = length(unique(dat$nr_checks_rand)))
rownames(tt) = c("count_checks_our","count_checks_Wil","count_checks_rand","minimal")
tt[1,] = round(table(dat$nr_checks_our)/length(filenames))
tt[2,] = round(table(dat$nr_checks_Wil)/length(filenames))
tt[3,] = round(table(dat$nr_checks_rand)/length(filenames))
tt[4,1] = round(sum(dat$minimum_check_number == 1)/length(filenames))
tt[4,2] = 0
tt[4,3] = round(sum(dat$minimum_check_number == 3)/length(filenames))
colnames(tt) = names(table(dat$nr_checks_rand))
@
<<>>=
print(tt)
@
\section{For Environmental permit log}
<<echo=FALSE, results='hide'>>=
filenames <- list.files()[grep(paste("^output_Envpermit(?=.*\\.csv)",sep=''), list.files(), perl=TRUE)]
dat = c()
result = matrix(0,nrow = length(filenames),ncol = 6)
colnames(result) = c("nr_checks_our","nr_checks_Wil","nr_checks_rand",
"overproc_our","overproc_Wil","overproc_rand")
for (i in 1:length(filenames)) {
foo = read.table(filenames[i],sep=",",header=TRUE)
dat = rbind(dat,foo)
result[i,1] = mean(foo$nr_checks_our)
result[i,2] = mean(foo$nr_checks_Wil)
result[i,3] = mean(foo$nr_checks_rand)
result[i,4] = mean(foo$nr_checks_our - foo$minimum_check_number)
result[i,5] = mean(foo$nr_checks_Wil - foo$minimum_check_number)
result[i,6] = mean(foo$nr_checks_rand - foo$minimum_check_number)
}
@
Minimal possible number of checks, averaged over \Sexpr{length(filenames)} test sets :
<<>>=
round(sum(dat$minimum_check_number)/length(filenames))
@
Average number of checks per test set that one would do if they follow \textbf{our ordering}:
<<>>=
round(sum(dat$nr_checks_our)/length(filenames))
@
Average number of checks that one would do if they apply \textbf{Wil's method} (constant reject probabilities):
<<>>=
round(sum(dat$nr_checks_Wil)/length(filenames))
@
Average number of checks that one would do if for every case they do checks in \textbf{random order}
<<>>=
round(sum(dat$nr_checks_rand)/length(filenames))
@
Average overprocessing (in \%) with our ordering:
<<>>=
round(100*(sum(dat$nr_checks_our) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
Average overprocessing with Wil ordering:
<<>>=
round(100*(sum(dat$nr_checks_Wil) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
Average overprocessing with random ordering:
<<>>=
round(100*(sum(dat$nr_checks_rand) - sum(dat$minimum_check_number))/(length(filenames)*sum(dat$minimum_check_number)/length(filenames)),digits = 2)
@
\textbf{Distribution of the number of checks performed}
<<echo=FALSE, results='hide'>>=
tt = matrix(0,nrow = 4,ncol = length(unique(dat$nr_checks_rand)))
rownames(tt) = c("count_checks_our","count_checks_Wil","count_checks_rand","minimal")
tt[1,] = round(table(dat$nr_checks_our)/length(filenames),digits = 1)
tt[2,] = round(table(dat$nr_checks_Wil)/length(filenames),digits = 1)
tt[3,] = round(table(dat$nr_checks_rand)/length(filenames),digits = 1)
tt[4,1] = sum(dat$minimum_check_number == 1)/length(filenames)
tt[4,2] = 0
tt[4,3] = sum(dat$minimum_check_number == 3)/length(filenames)
colnames(tt) = names(table(dat$nr_checks_rand))
@
<<>>=
print(tt)
@
\end{document}