generateNormalPriorData {MoTBFs} | R Documentation |
Prior data generation
Description
Generate a prior dataset taking in to account the relationships between the varibles in a given network.
Usage
generateNormalPriorData(graph, data, size, means, deviations = NULL)
Arguments
graph |
A network of the class |
data |
An object of class |
size |
A positive integer indicating the number of records to generate for each variable in the dataset. |
means |
A |
deviations |
A |
Value
A normal prior data set of class "data.frame"
.
See Also
Examples
## Data
data(ecoli)
data <- ecoli[,-c(1,9)] ## remove sequece.name and class
X <- TrainingandTestData(data, percentage_test = 0.95)
Xtraining <- X$Training
Xtest <- X$Test
## DAG
dag <- LearningHC(data)
plot(dag)
## Means and desviations
colnames(data)
m <- sapply(data, function(x){ifelse(is.numeric(x), mean(x),NA)})
d <- sapply(data, function(x){ifelse(is.numeric(x), sd(x),NA)})
## Prior Dataset
n <- 5600
priorData <- generateNormalPriorData(dag, data = Xtraining, size = n, means = m)
summary(priorData)
ncol(priorData)
nrow(priorData)
class(priorData)