-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_correctness.R
143 lines (129 loc) · 6.21 KB
/
check_correctness.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
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
rm(list=ls());gc()
library(data.table)
library(ggplot2)
library(reshape2)
setwd("D:/Users/Benjamin/Documents/EJE-2211")
library(data.table)
############################
#chechk correctnes for months
months = fread("data/Costes_mois_x1x2_20150311.csv", #le nom du document
header = T, #oui il y a une entete
sep = ";", #le separateur *
colClasses = c(numero_joueur="integer", #le type de toute les colonnes *
numero_compte="integer",
operateur="integer",
mois="character",
ps_mises="integer",
ps_gains="integer",
ph_mises="integer",
ph_gains="integer",
ph_simple_mises="integer",
ph_complexe_mises="integer",
ps_complexes_mises="integer",
ps_live_mises="integer",
ps_foot_mises="integer",
ps_tennis_mises="integer",
ps_basket_mises="integer",
ps_rugby_mises="integer",
ps_autres_mises="integer",
depots_3en12h="integer",
depots_1hapresmise="integer")
)
#there is indeed problems !
months[abs((ph_simple_mises+ph_complexe_mises)-ph_mises)>0.5,]
#5 rows does not match !
months[abs((ps_autres_mises+ps_rugby_mises+ps_tennis_mises+ps_foot_mises+ps_basket_mises)-ps_mises)>0.5,]
#4146 rows do not math !
hist(months[abs((ps_autres_mises+ps_rugby_mises+ps_tennis_mises+ps_foot_mises+ps_basket_mises)-ps_mises)>0.5,
(ps_autres_mises+ps_rugby_mises+ps_tennis_mises+ps_foot_mises+ps_basket_mises)-ps_mises],
main = "difference dans les paris sportifs (mois)",xlab = "difference",ylab = "frequence")
months[abs((ps_autres_mises+ps_rugby_mises+ps_tennis_mises+ps_foot_mises+ps_basket_mises)-ps_mises)>0.5 |
abs((ph_simple_mises+ph_complexe_mises)-ph_mises)>0.5,]
nrow(months[abs((ps_autres_mises+ps_rugby_mises+ps_tennis_mises+ps_foot_mises+ps_basket_mises)-ps_mises)>0.5 |
abs((ph_simple_mises+ph_complexe_mises)-ph_mises)>0.5,])/nrow(months)
############################
#chechk correctnes for days
days = fread("data/Costes_jour_x1x2_20150311.csv", #le nom du document
header = F, #oui il y a une entete
sep = ";", #le separateur *
)
setnames(days,c("numero_joueur",
"numero_compte",
"operateur",
"jour",
"paris_sportifs_nombre",
"paris_sportifs_mises",
"paris_hippiques_nombre",
"paris_hippiques_mises",
"caves_nombre",
"caves_euros",
"depots_nombre",
"depots_valeur",
"retrait_nombre",
"retrait_valeur",
"bonus_ps_nombre",
"bonus_ps_montant",
"bonus_ph_nombre",
"bonus_ph_montant",
"bonus_jc_nombre",
"bonus_jc_montant"))
#########################################
#chechk correctnes for months vs sum(days)
#agregate the days (sum)
days[,mois := paste0(gsub("-..$","",jour),"-01")]
days[1354854,mois]
setkeyv(days,c("numero_joueur",
"numero_compte",
"mois"))
monthsFromDays = days[,list(paris_sportifs_nombre = sum(paris_sportifs_nombre,na.rm = T),
paris_sportifs_mises = sum(paris_sportifs_mises,na.rm = T),
paris_hippiques_nombre = sum(paris_hippiques_nombre,na.rm = T),
paris_hippiques_mises = sum(paris_hippiques_mises,na.rm = T),
caves_nombre = sum(caves_nombre,na.rm = T),
caves_euros = sum(caves_euros,na.rm = T),
depots_nombre = sum(depots_nombre,na.rm = T),
depots_valeur = sum(depots_valeur,na.rm = T),
retrait_nombre = sum(retrait_nombre,na.rm = T),
retrait_valeur = sum(retrait_valeur,na.rm = T),
bonus_ps_nombre = sum(bonus_ps_nombre,na.rm = T),
bonus_ps_montant = sum(bonus_ps_montant,na.rm = T),
bonus_ph_nombre = sum(bonus_ph_nombre,na.rm = T),
bonus_ph_montant = sum(bonus_ph_montant,na.rm = T),
bonus_jc_nombre = sum(bonus_jc_nombre,na.rm = T),
bonus_jc_montant = sum(bonus_jc_montant,na.rm = T))
,by = key(days)]
#comparing the values for some variables
setkeyv(months,c("numero_joueur",
"numero_compte",
"mois"))
setkeyv(monthsFromDays,c("numero_joueur",
"numero_compte",
"mois"))
bothMonth = cbind(months[,list(numero_joueur,
numero_compte,
mois,
ps_mises,
ph_mises)],
monthsFromDays[,list(paris_sportifs_mises,
paris_hippiques_mises)])
bothMonth[abs(ps_mises-paris_sportifs_mises) > 0.5,]
#263 rows !
bothMonth[abs(ph_mises-paris_hippiques_mises) > 0.5,]
#55406 rows !
hist(bothMonth[abs(ph_mises-paris_hippiques_mises) > 0.5,ph_mises-paris_hippiques_mises],
1000,
main = "difference dans les paris hippique mises (jours vs mois)",
xlab = "difference",ylab = "frequence",
xlim = c(-1000,1000))
abline(v = c(mean(bothMonth[ph_mises> 0,ph_mises]),
mean(bothMonth[paris_hippiques_mises> 0,paris_hippiques_mises]) ),
col = c('blue','red'),
lty = 2)
legend("topleft",
legend = c("moyenne mensuelle","moyenne sum(jours)"),
lty = 2,
col = c("blue","red") )
bothMonth[abs(ph_mises-paris_hippiques_mises) > 0.5 |
abs(ps_mises-paris_sportifs_mises) > 0.5, ]
nrow(bothMonth[abs(ph_mises-paris_hippiques_mises) > 0.5 |
abs(ps_mises-paris_sportifs_mises) > 0.5, ])/nrow(bothMonth)