-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_ours_nltcs.R
48 lines (41 loc) · 2.22 KB
/
run_ours_nltcs.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
library(furrr)
plan(multisession(workers=4))
library(exchanger)
library(tidyverse)
source("util.R")
source("run_ours.R")
setwd("./datasets")
source("load_nltcs.R")
setwd("../")
snbinom_var <- n_records^2
snbinom_size <- (n_records - 1)^2 / (snbinom_var - n_records + 1)
snbinom_prob <- (n_records - 1) / snbinom_var
expt_configs = list(
list(name = "coupon", clust_prior = GeneralizedCouponRP(ShiftedNegBinomRV(snbinom_size, snbinom_prob), GammaRV(1, 1/100))),
list(name = "py", clust_prior = PitmanYorRP(GammaRV(1, 1/100), BetaRV(1, 1))),
list(name = "ewens", clust_prior = EwensRP(GammaRV(1, 1/100))),
list(name = "blinkcoupon", clust_prior = GeneralizedCouponRP(nrow(records), Inf))
)
future_map(expt_configs, function(e) {
distort_prior <- BetaRV(1, 4)
attr_params <- c(
"SEX" = CategoricalAttribute(distort_prior,
distort_dist_prior = DirichletProcess(GammaRV(2, 1e-4)),
entity_dist_prior = DirichletRV(1.0)),
"DOB_DAY" = CategoricalAttribute(distort_prob_prior = distort_prior,
distort_dist_prior = DirichletProcess(GammaRV(2, 1e-4)),
entity_dist_prior = DirichletRV(1.0)),
"DOB_MONTH" = CategoricalAttribute(distort_prob_prior = distort_prior,
distort_dist_prior = DirichletProcess(GammaRV(2, 1e-4)),
entity_dist_prior = DirichletRV(1.0)),
"DOB_YEAR" = CategoricalAttribute(distort_prob_prior = distort_prior,
distort_dist_prior = DirichletProcess(GammaRV(2, 1e-4)),
entity_dist_prior = DirichletRV(1.0)),
"REGOFF" = CategoricalAttribute(distort_prior,
distort_dist_prior = DirichletProcess(GammaRV(2, 1e-4)),
entity_dist_prior = DirichletRV(1.0))
)
model <- exchanger(records, attr_params, e$clust_prior)
expt_name <- paste0("nltcs_ours_", e$name, "_", gsub("[ :]", "_", date()))
run_ours(expt_name, model, true_membership, n_samples = 10000, burnin_interval = 100000)
}, .options = furrr_options(packages=c("comparator", "exchanger", "clevr")))