Questions tagged [pgmpy]

34 questions
4
votes
1 answer

StopIteration error while drawing a PGMPy Networkx graph

I have a python script that loads a csv file using pandas, and then uses pgmpy to learn a bayesian network over the data. After learning the structure, I am drawing the graph using the function: nx.draw(graph_model, node_color='#00b4d9',…
4
votes
2 answers

How to print the printing full cpd from pgmpy?

I'm trying to get the example in Insurance data representation with Bayesian networks to work. See the section Maximum Likelihood Estimation. The data I got from the bnlearn package in R and then uploaded it my google drive. The data The picture…
user2946746
  • 1,740
  • 3
  • 21
  • 36
3
votes
1 answer

Using NetworkX, how is it possible to plot a directed, unweighted graph, given set of edges with a legend?

I am currently working on a project where I have to deal with Bayesian Networks and given the graphical nature of these probabilistic models, it is very essential to visualize them as a graph. I am using pgmpy for my project. The model I am dealing…
Danish A. Alvi
  • 161
  • 1
  • 8
2
votes
0 answers

Bayesian Networks: Structure Learning in Python is extremely slow compared to R

I'm currently working on a problem to do image classification on images using Bayesian Networks. I have tried using pomegranate, pgmpy and bnlearn. My dataset contains more than 200,000 images, on which I perform some feature extraction algorithm…
Hari Krishnan
  • 2,049
  • 2
  • 18
  • 29
2
votes
1 answer

pgmpy build error Anaconda Windows

When installing `pgmpy on Anaconda under Windows, using these instructions, I get Installing coverage-3.5-script.py script to C:\Users\idf\Anaconda3\Scripts Traceback (most recent call last): File "setup.py", line 28, in "coveralls >=…
Ivan
  • 7,448
  • 14
  • 69
  • 134
1
vote
1 answer

Create Variable Elimination with multiple possible values in pgmpy

I would like to create a VariableElimination with multiple possible values with the pgmpy framework. The case is that I have a variable with 4 possible states, and I want to know that conditional probability of if 3 of those values are eligible.…
Bob West
  • 21
  • 6
1
vote
0 answers

Issue using MaximumLikelihoodEstimator.estimate_cpd() from pgmpy when using dataframe with tuples as columns names as parameter

When I use a dataframe with only text as columns names the code works fine. Now I need to use a dataframe with tuples as columns names as parameter for MaximumLikelihoodEstimator.estimate_cpd() method from pgmpy.estimators, but it raises the…
1
vote
1 answer

I built a Bayesian Belief Network in Python with the pgmpy library. My for-loop (made to predict data from evidence) stops after 584 iterations

I am working on a dataset of 5 columns (named 'Healthy', 'Growth', 'Refined', 'Reasoned', 'Accepted') and 50k rows. I divided it into a train dataset (10k) and a validation set (the rest of the dataset). I built a Bayesian Belief Network with the…
1
vote
1 answer

Pgmpy: expectation maximization for bayesian networks parameter learning with missing data

I'm trying to use the PGMPY package for python to learn the parameters of a bayesian network. If I understand expectation maximization correctly, it should be able to deal with missing values. I am currently experimenting with a 3 variable BN, where…
1
vote
1 answer

How to get the probability of a new event in Bayesian network using pgmpy?

I have trained a Bayesian network using pgmpy library. I wish to find the joint probability of a new event (as the product of the probability of each variable given its parents, if it has any). Currently I am doing infer =…
1
vote
0 answers

Error while trying to make predictions with pgmpy Bayesian Model

I've got a dataset on an excel file and I'm trying to train a Bayesian Model in order to make some predictions on the data. I'm using pandas for the dataframe, and pgmpy for the Bayesian Model. I'm able to make the model make predictions on data…
Viv
  • 11
  • 1
1
vote
0 answers

Predicting values using Bayesian model and getting error

Dataset fileI am predicting no_of_people values using bayesian model in python. I am using this dataset given in picture.my error is also attached in the picture #My code is here import numpy as np from pgmpy.models import BayesianModel import…
1
vote
0 answers

pgmpy, BayesianModel: How to get probability for a given sample

I am using the pgmpy package in python. I used the BayesianModelSampler class to sample from a BayesianModel that represents a joint distribution over multiple discrete variables. I would like to get the probability for a given sample. Is there a…
EyalItskovits
  • 116
  • 1
  • 9
1
vote
2 answers

TypeError: 'DiscreteFactor' object is not subscriptable

I have a Bayesian algorithm program to be executed, I am using python 3 import numpy as np import csv import pandas as pd from pgmpy.models import BayesianModel from pgmpy.estimators import MaximumLikelihoodEstimator from pgmpy.inference import…
Manoj Shivaprakash
  • 105
  • 1
  • 2
  • 12
1
vote
2 answers

When I try to implement MarkovModel using pgmpy, is there a way to fix KeyError?

I'm trying to implement Markov Random Field. Among them, I would like to obtain a value of phi(A|B = 0, C = 1). However, with the evidence option, KeyError: 'B' occurs. I don't know why this happens. Below is the code. from pgmpy.inference import…
prior
  • 13
  • 3
1
2 3