-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.r
77 lines (60 loc) · 2.46 KB
/
data.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
72
73
74
75
library(dplyr)
library(tidyr)
source("monitor.r")
GetSysDataInfo <- function(sysID) {
# Loads data for specified configurable software system
#
# Args:
# sysID: ID of the system to be loaded
# Load system data
sysDataFile <- file.path("data", "systems",
paste(systemNames[sysID], ".csv", sep = ""))
sysData <- read.csv(sysDataFile,
na.strings = c(".", "NA", "", "?"),
strip.white = TRUE, encoding = "UTF-8")
# Non-feature columns: PERF
features <- colnames(sysData)
nonFeat <- c("PERF")
features <- features[!(features %in% nonFeat)]
featureNum <- length(features)
# 'samples' is a list of 'sampleNum' lists of length 'sampleRep'
# 'samples' contains all necessary data samples for analysing the specified
# system
samples <- list()
samples <- c(samples, 1:experParams$sampleSizes)
sampleSizes <- 1:experParams$sampleSizes
sampleSizes <- sampleSizes * featureNum
# Fill 'samples' with newly generated data samples
# 'i' iterates over lists
# 'j' iterates over individual samples in lists
for (i in 1:experParams$sampleSizes) {
equisizedSamples <- list()
# Populate new list with 'sampleRep' samples of the same size
# TODO: check randomization seed
for (j in 1:experParams$sampleRep) {
smpl <- sample(nrow(sysData), sampleSizes[i])
equisizedSamples <- c(equisizedSamples, list(smpl))
}
samples[[i]] <- equisizedSamples
}
# Initialize list that will contain all system data information
dataInfo <- list()
dataInfo$sysID <- sysID # Configurable system ID
dataInfo$sysName <- systemNames[sysID] # Configurable system name
dataInfo$sysData <- sysData # Configurable system data
dataInfo$features <- features # Configuration features
dataInfo$featureNum <- featureNum # Number of configuration features
dataInfo$sampleSizes <- sampleSizes # List of sample sizes
dataInfo$samples <- samples # List (for each machine) of
# Lists (for each sample size) of
# Samples
Monitor(paste("System ID:", dataInfo$sysID))
Monitor(paste("System Name:", dataInfo$sysName))
Monitor(paste("Features:", dataInfo$featureNum))
Monitor(dataInfo$features)
Monitor("Sampling sizes:")
Monitor(dataInfo$sampleSizes)
Monitor("Samples:")
Monitor(dataInfo$samples)
return(dataInfo)
}