Git Product home page Git Product logo

bnc_sdd's Introduction

BNC_SDD

Converts a Bayesian Network Classifier (BNC) into a Sentential Decision Diagram (SDD) by first compiling an Ordered Decision Diagram (ODD) and then converting the ODD into a SDD. The algorithm is described in the following paper:

Compiling Bayesian Networks into Decision Graphs
In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence (AAAI), 2019
Andy Shih, Arthur Choi, Adnan Darwiche

Input Format

The input BNC is specified using "config.json". It should have a JSON object with the following fields:

  • "id": some number to help you distinguish the compilation task
  • "name": name of the .net or the .uai Bayesian Network file
  • "filetype": filetype of the Bayesian Network file (either ".net" or ".uai")
  • "vars": number of feature variables
  • "root": class node of the Bayesian Network Classifier
  • "leaves": a list of the feature variables. If empty, defaults to all leaves of the Bayesian Network. If not empty, length should match "vars"
  • "threshold": threshold of the Bayesian Network Classifier
  • "input_filepath": filepath of the Bayesian Network file
  • "output_filepath": filepath to write the output ODD and SDD

The underlying Bayesian Network of the BNC is specified as a .net file or a .uai file. The file that will be looked up is config["input_filepath"] + config["name"] + "." + config["filetype"]. For example, if the filepath of the network file is at "networks/binarynetworks/admission.net", then we set config["input_filepath"]: "networks/binarynetworks/", config["name"]: "admission", and config["filetype"]: "net".

You can also run RunCompiler with the network file as an argument. In this mode, you can choose to supply either one (network_file) or four (network_file, id, root, threshold) arguments. Both modes will pull all relevant config information from the file itself, but the first mode makes some guesses and defaults for the additional arguments that the second mode would have supplied:

  • id will be 1
  • root will be the first root in the list
  • threshold will be the second ("no" case) probability in the CPT of the root.

Assumptions

The underlying Bayesian Network should be completely binary (all interal nodes and leaves are binary). Furthermore, there should be no hard CPTs (no 0/1 values in CPTS).

If you run with the network_file version, this will be checked automatically, and Exception if the network is not binary and soft. I make no guarantees to the time efficiency of this check...

Output Format

The output of the program will be 4 files:

  • ODD file: The ODD representation of the decision function of the BNC
  • SDD file: The SDD representation of the decision function of the BNC
  • vtree file: The vtree accompanying the SDD
  • variable description file: A description of the variables of the ODD/SDD (includes variable order, metadata)

The ODD file will be written at config["output_filepath"] + config["name"] + "_" + config["id"] + ".odd"

The SDD file will be written at config["output_filepath"] + config["name"] + "_" + config["id"] + ".sdd"

The vtree file will be written at config["output_filepath"] + config["name"] + "_" + config["id"] + ".vtree"

The variable description file will be written at config["output_filepath"] + config["name"] + "_" + config["id"] + ".txt"

If running with the network_file version, a .json config file will also be produced in the same output folder, with the same form as those above, for the selected root.

Running BNC_SDD

./run

modify run to change the usage of RunCompiler There is also a ConfigGenerator that one can run to pull all network files from a directory and generate the config files for all roots in those networks. This uses the cpt probability method described above to determine the threshold. Both of these have examples in the run file

Further Questions

Contact us at

Andy Shih: [email protected]
Arthur Choi: [email protected]
Adnan Darwiche: [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.