-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsynrec_Output.R
47 lines (30 loc) · 1.28 KB
/
synrec_Output.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
install.packages("synthpop")
library("synthpop")
######################read dataset####################################
ratings <- read.csv("Data/obsRating.csv")
ratings$timestamp <- NULL
ratings$rating= factor(as.character(ratings$rating))
my.seed <- 100000
sdsRating <- syn(ratings, visit.sequence = c(1, 2, 3), method = c(" ", " ", "cart"), m=5, seed = NA, proper = FALSE)
sdsRating
summary(sdsRating)
head(sdsRating)
compare(sdsRating, ratings, vars = "rating", msel=1:5)
model.ratings <- glm(rating ~ userid + itemid,
family = "gaussian", data = ratings)
model.ratings
model.sds <- glm.synds(rating ~ userid + itemid,
family = "gaussian", data = sdsRating)
model.sds
compare.fit.synds(model.sds, ratings, msel=1:3)
u1 <- utility.gen(sdsRating, ratings)
u1 <- utility.tab(sdsRating, ratings, vars = "rating")
print(u1, print.zscores = TRUE, usethresh = TRUE)
sdsRating
write.syn(sdsRating, filename = "CARTdraft", filetype = "csv", convert.factors = "numeric", data.labels = NULL, save.complete = TRUE )
######################
sdssdc <- sdc(sdsRating, ratings, label = "false_data",
rm.replicated.uniques = TRUE, recode.vars = "rating",
bottom.top.coding = c(200, 5000), recode.exclude = -8)
View(sdssdc)
sdssdc