K2 algorithm for learning DAG structure in Bayesian network

This is the code of Cooper's K2 algorithm proposed in 1992, quick and convenient for using.
3.9K Downloads
Updated 6 Jun 2013

View License

K2 algorithm is the most famous score-based algorithm in Bayesian netowrk in the last two decades. Specifically, it recovers the underlying distribution in the form of DAG efficiently. For details, please refer to Cooper's published paper[1]

Please start from "ControlCentor.m", here is a simple example for understanding how to use our code.

If there is any question, please let me know, i will help you as soon as possible.

I use rewritten the K2 by mex programming, if you know how to compile it, please try K2.c because this code is able to handle the variables as large as 1000 variables, much efficient. It's tested under linux both 32-bit and 64-bit.

[1] G. Cooper and E. Herskovitz, A Bayesian method for the induction of probabilistic networks from data, Machine Learning
9 (1992), 330–347.

If you use this code, please cite our paper:

Bielza, C., Li, G. & Larrañaga, P. (2011). Multi-Dimensional Classification with Bayesian Networks. International Journal of Approximate Reasoning, 52, 705-727.

Cite As

Guangdi Li (2024). K2 algorithm for learning DAG structure in Bayesian network (https://www.mathworks.com/matlabcentral/fileexchange/23273-k2-algorithm-for-learning-dag-structure-in-bayesian-network), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Networks in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.7.0.0

update description

1.6.0.0

improve the efficiency of code by mex programming.

1.4.0.0

Update the code to output the K2 score upon each node

1.2.0.0

I improve the efficiency of this algorithm again.

1.1.0.0

One file is missing, sorry, I add it again.

1.0.0.0