mcmc {BayesFluxR} | R Documentation |

## Sample from a BNN using MCMC

### Description

Sample from a BNN using MCMC

### Usage

```
mcmc(
bnn,
batchsize,
numsamples,
sampler = sampler.SGLD(stepsize_a = 1),
continue_sampling = FALSE,
start_value = NULL
)
```

### Arguments

`bnn` |
A BNN obtained using |

`batchsize` |
batchsize to use; Most samplers allow for batching. For some, theoretical justifications are missing (HMC) |

`numsamples` |
Number of mcmc samples |

`sampler` |
Sampler to use; See for example |

`continue_sampling` |
Do not start new sampling, but rather continue sampling For this, numsamples must be greater than the already sampled number. |

`start_value` |
Values to start from. By default these will be sampled using the initialiser in 'bnn'. |

### Value

a list containing the 'samples' and the 'sampler' used.

### Examples

```
## Not run:
## Needs previous call to `BayesFluxR_setup` which is time
## consuming and requires Julia and BayesFlux.jl
BayesFluxR_setup(installJulia=TRUE, seed=123)
net <- Chain(Dense(5, 1))
like <- likelihood.feedforward_normal(net, Gamma(2.0, 0.5))
prior <- prior.gaussian(net, 0.5)
init <- initialise.allsame(Normal(0, 0.5), like, prior)
x <- matrix(rnorm(5*100), nrow = 5)
y <- rnorm(100)
bnn <- BNN(x, y, like, prior, init)
sampler <- sampler.SGNHTS(1e-3)
ch <- mcmc(bnn, 10, 1000, sampler)
## End(Not run)
```

[Package

*BayesFluxR*version 0.1.3 Index]