Created
May 13, 2011 13:37
-
-
Save rjbgoudie/970554 to your computer and use it in GitHub Desktop.
parental: basic operation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A `bn` object is created by specifying the parents of each node. | |
x <- bn(c(2), c(), c(1, 2)) | |
grplot(x) | |
# Adjacency matrices can be converted to a `bn` using `as.bn`. | |
adj <- matrix(c(0, 0, 1, 1, 0, 0, 0, 0, 0), 3, 3) | |
x <- as.bn(adj) | |
grplot(x) | |
# Properties of a `bn` | |
x <- bn(c(2), c(), c(1, 2)) | |
nNodes(x) | |
nEdges(x) | |
indegrees(x) | |
# Sample a BN | |
sampleBN(10) | |
sampleBN(10, maxNumberParents = 2) | |
# An empty graph | |
empty(10, "bn") | |
Enumerate all the Bayesian Networks | |
# enumerateBNSpace(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment