discreteStatesFromBN | R Documentation |
This function returns the states of all discrete nodes from a list obtained from MoTBFs_Learning.
discreteStatesFromBN(bn, dag)
bn |
A list of lists obtained from MoTBFs_Learning. |
dag |
A network of class |
discreteStatesFromBN
returns a list of length equal to the number of discrete nodes in the network. Each element of the list corresponds to a node and contains a character vector indicating the states of the node.
## Create a dataset
# Continuous variables
x <- rnorm(100)
y <- rnorm(100)
# Discrete variable
z <- sample(letters[1:2],size = 100, replace = TRUE)
data <- data.frame(C1 = x, C2 = y, D1 = z, stringsAsFactors = FALSE)
## Get DAG
dag <- LearningHC(data)
## Learn a BN
bn <- MoTBFs_Learning(dag, data, POTENTIAL_TYPE = "MTE")
## Get the states of the discrete nodes
discreteStatesFromBN(bn, dag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.