forked from SteffenMoritz/Synthetic_Data_Challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdnist.R
46 lines (27 loc) · 975 Bytes
/
sdnist.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
# install.packages("reticulate")
load("satgpa.rda")
sat <- satgpa[1:30,]
install_miniconda()
library(reticulate)
# Falls nicht auf System vorhanden
# reticulate::install_python()
# reticulate::install_miniconda()
original <- as.data.frame(sat)
original$sex <- as.numeric(original$sex)
original$sat_v <- as.numeric(original$sat_v)
original$sat_m <- as.numeric(original$sat_m)
original$sat_sum <- as.numeric(original$sat_sum)
py_available(initialize = TRUE)
#use_python("/usr/local/bin/python")
Sys.which("python")
py_version()
use_virtualenv("synthchallenge")
virtualenv_install("synthchallenge", "numpy")
reticulate::repl_python("sdnist")
#### Python Code
import sdnist
>>> dataset, schema = sdnist.census() # Retrieve public dataset
>>> dataset.head()
>>> synthetic_dataset = dataset.sample(n=20000) # Build a fake synthetic dataset
# Compute the score of the synthetic dataset
>>> sdnist.score(dataset, synthetic_dataset, schema, challenge="census")