-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
46 lines (46 loc) · 2.34 KB
/
.Rhistory
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
setwd("C:\Users\Manue\Documents\manip\R\serveur_cluster_these\cluster\dorcel")
setwd("~/github/TimeSeriesBandit/TimeSeriesBandits")
setwd("~\Users\Manue\Documents\manip\R\serveur_cluster_these\cluster\dorcel")
setwd("~/Users/Manue/Documents/manip/R/serveur_cluster_these/cluster/dorcel")
setwd("~/manip/R/serveur_cluster_these/cluster/dorcel")
#Importe data
library(jsonlite)
data.train <- jsonlite::fromJSON("parcoursuserDatabaseFinalModz1.JSON", simplifyDataFrame = TRUE)
visitorReward <- jsonlite::fromJSON("parcours_reward_modz.JSON", simplifyDataFrame = TRUE)
#global summary of data
summary(as.factor(visitorReward$A))
summary(as.factor(visitorReward$B))
#which covariate will be observe?
#here covariates are time series
listInteger = c( "presence_time_serie" , "time_spend_time_serie" , "connexion_time_time_serie" )
#don't use time series with lenght smaller than 2
data.train <-data.train[data.train$size_time_serie>1 , ]
#how many transaction do we have now?
summary(as.factor(data.train$transactions))
#define time series as numerical time series
data.train$presence_time_serie <- lapply(data.train$presence_time_serie, as.numeric)
data.train$connexion_time_time_serie <- lapply(data.train$connexion_time_time_serie, as.numeric)
data.train$time_spend_time_serie <- lapply(data.train$time_spend_time_serie, as.numeric)
#remplace NA by 0 (encoding problem for 2 time series)
for(i in 1:nrow(data.train)) data.train$time_spend_time_serie[i] <- lapply(data.train$time_spend_time_serie[i] ,function(x) replace(x,is.na(x),0))
list_cluster_k <- c(3,3,3)
library(dplyr)
my_obj <- dba_clust_generate(dt = data.train, learn_size = (0.3*nrow(data.train)), explanatory_variable = listInteger, list_cluster_k = list_cluster_k , print_graph = "none")
#load bandit4abtest package
library(devtools)
install.packages("devtools")
#load bandit4abtest package
library(devtools)
install_github("R-workshop-strasbourg/bandit4abtest")
install_github("bandit4abtest")
#load bandit4abtest package
library(devtools)
install_github("bandit4abtest")
install_github("R-workshop-strasbourg/bandit4abtest")
install_github("bandit4abtest/bandit4abtest")
githubinstall("bandit4abtest/bandit4abtest")
install.packages("githubinstall")
library(githubinstall)
githubinstall("bandit4abtest/bandit4abtest")
githubinstall(" R-workshop-strasbourg/bandit4abtest ")
githubinstall("R-workshop-strasbourg/bandit4abtest")