pgmpy / pgmpy

Python Library for learning (Structure and Parameter), inference (Probabilistic and Causal), and simulations in Bayesian Networks.

Home Page:https://pgmpy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test Bayesian Network inference with split training/test data

sandilyasg opened this issue · comments

Subject of the issue

I have a Bayesian Network which I trained to learn CPDs using training data (specifically using Expectation Maximization). I am using Variable Elimination for doing probabilistic inference to compute marginal posterior probabilities of some variables. My training data includes labels for input and output variables of a system. I used this data to learn the CPDs in my Bayesian Network. I want to use this training data, only with the input variables as input to my Bayesian network query, and compute the posterior probabilities of my output variables using the BN query. I want to do this to evaluate in-sample performance of my trained Bayesian Network. Is there a feature in pgmpy library that will allow me to do this easily? I wanted to check before I write my own script to split test/train data and evaluate results.

Your environment

  • pgmpy version 0.1.21
  • Python version 3.7
  • Operating System: Linux Ubuntu 18.04

@sandilyasg Unfortunately, there's no direct function in pgmpy to do this. You will have to write a script to do it.