This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eda_hard.R
71 lines (64 loc) · 3.05 KB
/
eda_hard.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
library(ggplot2)
library(tidyr)
library(dplyr)
library(purrr)
library(magrittr)
library(aslib)
library (llama)
# Load dataset from file and convert to LLAMA object
dataset_raw <- parseASScenario("GRAPHS-2015")
dataset_structured <- convertToLlamaCVFolds(dataset_raw)
#Presolver 1: Filter instances solved by IncompleteLAD
dataset_notPresolved <- dataset_structured
presolved_ids <- dataset_raw$feature.runstatus$instance_id[dataset_raw$feature.runstatus$lad_features == "presolved"]
dataset_notPresolved$data <- subset(dataset_structured$data, !(dataset_structured$data$instance_id %in% presolved_ids))
dataset_notPresolved$best <- subset(dataset_structured$best, !(dataset_structured$data$instance_id %in% presolved_ids))
# Presolver 2: Filter instances solved by VF2 within 50 ms
dataset_hard <- dataset_notPresolved
dataset_hard$data <- subset(dataset_notPresolved$data, dataset_notPresolved$data$vf2 > 50)
dataset_hard$best <- subset(dataset_notPresolved$best, dataset_notPresolved$data$vf2 > 50)
dataset_hard <- cvFolds(dataset_hard)
cat("Count of all instances =", nrow(dataset_structured$data), ", Count of hard instances =", nrow(dataset_hard$data)) # should be 5725 and 2336
# Peruse dataset
head(dataset_hard$data[,c("instance_id",dataset_hard$features)],10)
head(dataset_hard$data[,c("instance_id",dataset_hard$performance)],10)
# Feature histograms
dataset_hard$data %>%
subset(select = c(2:37)) %>%
keep(is.numeric) %>%
gather() %>%
group_by(key) %>%
mutate(med = median(value)) %>%
ggplot(aes(value)) +
geom_histogram() +
facet_wrap(~ key, scales = "free", ncol = 4) +
geom_vline(aes(xintercept= med, group = key),
color = "red", linetype = "dashed",
size = 1)
# Algorithm runtimes histograms
dataset_hard$data %>%
subset(select = dataset_hard$performance) %>%
keep(is.numeric) %>%
gather() %>%
group_by(key) %>%
mutate(med = median(value)) %>%
ggplot(aes(value)) +
geom_histogram() +
facet_wrap(~ key, scales = "free", ncol = 2) +
geom_vline(aes(xintercept= med, group = key),
color = "red", linetype = "dashed",
size = 1)
# Algorithm runtimes histograms, log-scaled
dataset_hard$data %>%
subset(select = dataset_hard$performance) %>%
add(1) %>% log10() %>%
keep(is.numeric) %>%
gather() %>%
group_by(key) %>%
mutate(med = median(value)) %>%
ggplot(aes(value)) +
geom_histogram() +
facet_wrap(~ key, scales = "free", ncol = 2) +
geom_vline(aes(xintercept= med, group = key),
color = "red", linetype = "dashed",
size = 1)