GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - chunwangpro/BayesNet_Sampling: Implementation of Prior Sampling, Rejection Sampling, Likelihood Weighting, and Gibbs Sampling for Bayesian Network Stochastic Inference.

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
error_vs_samples.png
error_vs_samples.png
 
 
gibbs_ask.py
gibbs_ask.py
 
 
legacy.py
legacy.py
 
 
likelihood_weighting.py
likelihood_weighting.py
 
 
main.py
main.py
 
 
rejection_sampling.py
rejection_sampling.py
 
 
utils.py
utils.py
 
 
weather.json
weather.json
 
 

Repository files navigation

BayesNet Inference & Sampling

This project implements various sampling techniques for Bayesian Networks, including Prior Sampling, Rejection Sampling, Likelihood Weighting, and Gibbs Sampling. It also includes comparison experiments between these techniques.

File Structure

  • main.py : The main script for running the experiments.
  • weather.json : Example data file representing a Bayesian network.
  • error_vs_samples.png : Output plot generated from the experiments.

Requirements

  • python >= 3.9

Usage

Navigate to the project directory and run the following command:

python ./main.py

The script will print the results of the sampling experiments in the terminal. Additionally, figures showing the comparison of errors vs. sample sizes will appear in a separate window.

Output figures will be automatically saved in the current directory after the script finishes running.

Results

The program outputs:

  1. The estimated probabilities for the query node using different sampling techniques.
  2. A plot comparing the mean error vs. the number of samples for Rejection Sampling, Likelihood Weighting, and Gibbs Sampling.

The plot is saved as error_vs_samples.png in the project folder and is displayed after the experiments are run. Multiple figures might be generated, and you'll need to close each one before the next appears.

error_vs_samples

About

Implementation of Prior Sampling, Rejection Sampling, Likelihood Weighting, and Gibbs Sampling for Bayesian Network Stochastic Inference.

Topics

bayesian-networkerror-reportinggibbs-samplinglikelihood-weightingprior-samplingrejection-samplingstochastic-inference

Resources

Readme
Apache-2.0 license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.