-
Notifications
You must be signed in to change notification settings - Fork 0
Adaptive MCMC based inference for probabilistic logic programs
License
arunwise/Adaptive-MCMC
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Requirements
============
1. XSB
2. perl (optional)
3. gnuplot (optional)
Usage
=====
Interactive mode
----------------
| ?- [ami].
| ?- load_files(['source1.P','source2.P',...]).
Whether the sampler should perform adaptive or non-adaptive sampling is
specified in the following way
| ?- adaptation(on). % adaptive sampling.
| ?- adaptation(off). % non-adaptive sampling.
The kind of resampling strategy to be followed is specified as follows
| ?- resampling_style(singleswitch). % single switch resampling.
| ?- resampling_style(multiswitch(P)). % multi switch resampling with
% probability of resampling P.
Invocations for unconditional and conditional queries are shown below.
If the 'burnin' and 'samplesize' of the markov chain are not specified
default values of 1000 and 10000 are used respectively.
Unconditional queries
| ?- prob(query, burnin, samplesize, probability).
| ?- prob(query, probability).
Conditional queries
| ?- cond_prob(query, evidence, burnin, samplesize, probability).
| ?- cond_prob(query, evidence, probability).
Examples corresponding to the above invocations using the 'fire-alarm'
bayesian network are shown below.
Unconditional queries
| ?- prob(faworld(yes, yes), 100, 5000, P).
| ?- prob(faworld(yes, yes), P).
Conditional queries
| ?- cond_prob(faworld(yes), faworld(yes, yes), 100, 5000, P).
| ?- cond_prob(faworld(yes), faworld(yes, yes), P).
The statistics related to the effect of sample size on the accuracy and
variance of the computed answer, the time required to collect the samples
and the average number of rejections can be obtained by using the following
invocation.
| ?- statistics(query, evidence, burnin, samplesize, intervals, experiments,
mean_probability, variance, mean_time, mean_rejections).
This invocation is explained using an example below.
| ?- statistics(faworld(yes), faworld(yes, yes), 100, 1000, 30, 5, P, V, T, R).
This invocation would run 5 markov chains each with a burnin of 100. After
the burnin period, the answers to the conditional query are computed for
sample sizes ranging from 1000 to 30000 (samplesize to samplesize*intervals)
Similarly the time required for computation and the number of rejections
are collected for sample sizes ranging from 1000 to 30000. Using this
data, the mean answer is computed for each sample size, similarly mean
time for computation and mean number of rejections are computed for each
sample size, as also the variance of the computed answer for each sample
size.
To write the statistics to a file use the below predicate. It writes the
collected statistics to the specified file in a CSV format. Each row in the
file corresponds to one interval.
| ?- write_stats(faworld(yes), faworld(ye, yes), 100, 1000, 30, 5, 'stats.csv').
Batch mode
----------
If you want to execute multiple queries in batch mode, make use of script.pl.
Before using script.pl compile startup.P.
| ?- compile('startup.P').
Modify the experiments.txt file to specify the queries to be executed. See
comments in script.pl and experiments.txt for usage.
Plotting
--------
The plot.pl script can be used to plot the data generated by the sampler.
See comments in plot.pl for usage.
Issues
======
In interactive mode we can execute only a single query at a time. If multiple
queries need to be executed, XSB session needs to be terminated and started afresh.About
Adaptive MCMC based inference for probabilistic logic programs
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published