View source: R/priorKnowledge.R
generateNormalPriorData | R Documentation |
Generate a prior dataset taking in to account the relationships between the varibles in a given network.
generateNormalPriorData(graph, data, size, means, deviations = NULL)
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 |
A normal prior data set of class "data.frame"
.
rnormMultiv
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.