Skip to content

Instantly share code, notes, and snippets.

@rjbgoudie
Created May 13, 2011 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjbgoudie/970554 to your computer and use it in GitHub Desktop.
Save rjbgoudie/970554 to your computer and use it in GitHub Desktop.
parental: basic operation
# 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