Skip to content

bkbilly/bayesian_networks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bayesian Networks

PyPI Version

Implementation for bayesian network with

  • Enumeration
  • Rejection Sampling
  • Likelihood Weighting

Install

sudo pip3 install --upgrade bayesian-networks

How to use

import bayesian_networks

testcase = {
    'netid': "burglary",
    'query': ('B', 'j,m'),
    'result': {True: 0.28, False: 0.72},
    'samples': 10000,
}

enum = bayesian_networks.Enumeration()
results = enum.run(testcase)
bayesian_networks.print_result(results, showcolors=True)

rejection = bayesian_networks.RejectionSampling()
results = rejection.run(testcase)
bayesian_networks.print_result(results, showcolors=True)

weighting = bayesian_networks.LikelihoodWeighting()
results = weighting.run(testcase)
bayesian_networks.print_result(results, showcolors=True)