Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gilles Kratzer
mcmcabn
Commits
25bded24
Commit
25bded24
authored
Mar 07, 2019
by
Gilles Kratzer
Browse files
updated package following CRAN submission
parent
e99a1c59
Pipeline
#1688
passed with stage
in 1 second
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
man/bsc-compute-asia.Rd
View file @
25bded24
...
...
@@ -15,7 +15,6 @@
}}
\examples{
\dontrun{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of score function
...
...
@@ -44,18 +43,7 @@ bsc.compute.asia <- buildscorecache(data.df = asia,
data.dists = dist.asia,
max.parents = 2)
mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(1000,99,1000),
seed = 42,
verbose = FALSE,
start.dag = "random",
prob.rev = 0.03,
prob.mbr = 0.03,
prior.choice = 2)
}
}
\keyword{datasets}
man/dist-asia.Rd
View file @
25bded24
...
...
@@ -15,7 +15,6 @@
}}
\examples{
\dontrun{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
...
...
@@ -39,6 +38,5 @@ dist.asia <- list(Asia = "binomial",
XRay = "binomial",
Dyspnea = "binomial")
}
}
\keyword{datasets}
man/mcmc-out-asia.Rd
View file @
25bded24
...
...
@@ -15,7 +15,7 @@
}}
\examples{
\dont
run
{
\dont
test
{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of scores computing function
...
...
man/mcmc.Rd
View file @
25bded24
...
...
@@ -91,16 +91,23 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
# the number of MCMC run is delibaretelly chosen too small (computing time)
# no thinning (usually not recommended)
# no burn-in (usually not recommended,
# even if not supported by any theoretical arguments)
data("mcmc_run_asia")
mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
# let us run: 0.03 REV, 0.03 MBR, 0.94 MC3 MCMC jumps
# with a random DAG as starting point
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(1000,
99,1000
0),
mcmc.scheme = c(100
,
0,0),
seed = 42,
verbose = FALSE,
start.dag = "random",
...
...
@@ -108,5 +115,66 @@ mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
prob.mbr = 0.03,
prior.choice = 2)
summary(mcmc.out.asia)
}}
summary(mcmc.out.asia.small)
# Uniquelly with MC3 moves
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = "random",
prob.rev = 0,
prob.mbr = 0,
prior.choice = 2)
summary(mcmc.out.asia.small)
#let us define a starting DAG (empty matrix = no arcs)
startDag <- matrix(data = 0,nrow = 8,ncol = 8)
#name it
colnames(startDag) <- rownames(startDag) <- names(dist.asia)
# Additionally, let us use the non informative prior
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = startDag,
prob.rev = 0,
prob.mbr = 0,
prior.choice = 1)
summary(mcmc.out.asia.small)
# let us define our very own prior
# we know that there should be a link between Smoking and LungCancer nodes
# empty matrix
priorDag <- matrix(data = 0,nrow = 8,ncol = 8)
# name it
colnames(priorDag) <- rownames(priorDag) <- names(dist.asia)
# parent = smoking; child = LungCancer
priorDag["LungCancer","Smoking"] <- 1
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = startDag,
prob.rev = 0,
prob.mbr = 0,
prior.choice = 3,
prior.dag = priorDag)
summary(mcmc.out.asia.small)
}
man/mcmc_run_asia.Rd
View file @
25bded24
...
...
@@ -19,7 +19,7 @@
}}
\examples{
\dont
run
{
\dont
test
{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of score function
...
...
man/plot.Rd
View file @
25bded24
...
...
@@ -42,10 +42,12 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#plot the mcmc run
plot(mcmc.out.asia)
}}
#plot cumulative max score
plot(mcmc.out.asia, max.score = TRUE)
}
man/print.Rd
View file @
25bded24
...
...
@@ -30,10 +30,7 @@ There exists a \code{\link{summary}} S3 function that displays more details.
\author{Gilles Kratzer}
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#print the MCMC run
print(mcmc.out.asia)
}
}
}
man/summary.Rd
View file @
25bded24
...
...
@@ -36,10 +36,7 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#summary the MCMC run
summary(mcmc.out.asia)
}
}
}
mcmcabn_0.1.tar.gz
View file @
25bded24
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment