rjbgoudie / structmcmc Goto Github PK
View Code? Open in Web Editor NEWA set of tools for performing structural inference for Bayesian Networks using MCMC in R
License: Other
A set of tools for performing structural inference for Bayesian Networks using MCMC in R
License: Other
I'm trying to get this script working. After executing line 14, the following error is thrown.
Error in if (nrow(arcs) == 0) return(TRUE) : argument is of length zero
install.packages("devtools")
library(devtools)
install_github("rjbgoudie/parental")
install_github("rjbgoudie/structmcmc")
library(structmcmc)
# Setup data frame
x1 <- factor(c("a", "a", "g", "c", "c", "a", "g", "a", "a"))
x2 <- factor(c(2, 2, 4, 3, 1, 4, 4, 4, 1))
x3 <- factor(c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE))
x <- data.frame(x1 = x1, x2 = x2, x3 = x3)
# Draw samples from the posterior using MC^3.
set.seed(1234)
initial <- bn(c(), c(), c())
priorgraph <- bn(c(), c(1), c(2))
prior <- priorGraph(priorgraph, 0.5)
mcmc <- posterior(data = x, method = "mc3", prior = prior,
nSamples = 10000, nBurnin = 1000, initial = initial)
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
I get the popup window "R session aborted. R encountered a fatal error. The session was terminated." when I try to run the examples from the README file with the argument method = "gibbs". Do I need to change the other arguments when methods = "gibbs"?
I am running R version 3.5.0
Hi, when executing the demo script for discrete data from the Readme, I get the following error
> mcmc <- posterior(data = x, method = "mc3", prior = prior,
+ nSamples = 10000, nBurnin = 1000, initial = initial)
Error in logScoreOfflineFUN(x = currentNetwork[[1]], logScoreParameters = logScoreParameters, :
class(logScoreParameters$data) == "matrix" are not all TRUE
Called from: logScoreOfflineFUN(x = currentNetwork[[1]], logScoreParameters = logScoreParameters, cache = cache)
I get this error after running:
x1 <- factor(c("a", "a", "g", "c", "c", "a", "g", "a", "a"))
x2 <- factor(c(2, 2, 4, 3, 1, 4, 4, 4, 1))
x3 <- factor(c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE))
x <- data.frame(x1 = x1, x2 = x2, x3 = x3)
set.seed(1234)
initial <- bn(c(), c(), c())
priorgraph <- bn(c(), c(1), c(2))
prior <- priorGraph(priorgraph, 0.5)
mcmc <- posterior(data = x, method = "mc3", prior = prior,
nSamples = 10000, nBurnin = 1000, initial = initial)
Any ideas how to fix this? I am just exploring the package and would like to debug a walkthrough of a few examples to see how it works.
Thanks!
The browser()
function is called inside the priorGraph function, meaning that Rstudio breaks and won't continue until enter is pressed. As this function is called many times I've not been able to run the example code given here
Section of code is below:
difference <- setdiff(x, graph[[i]])
difference <- length(difference)
browser()
exp(-lambda * difference)
RStudio Version 1.1.419
Just FYI, I also had to install the following packages, in addition to parental
:
install.packages(c("bit", "fastmatch", "testthat"))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.