ankurankan on dev
Adds appoximate inference using… (compare)
Good morning, I have a quick question. I'm using structure learning to find structures with the K2Score method and BICScore method. When inspecting the scores afterwards, one gives a higher score for K2, and the other gives a higher score for BIC, which makes sense. But, how do I know which model fits the dataset better? Is there a common score both have to compare the two model and find the better one?
@ankurankan do you know how to approach this?
[('X', 100)]to query the CPD of X in the the 100th time slice.
BDeuScoreand pass it to HillClimb. Here's an example:
from pgmpy.utils import get_example_model from pgmpy.sampling import BayesianModelSampling from pgmpy.estimators import BDeuScore, HillClimbSearch alarm = get_example_model('alarm') s = BayesianModelSampling(alarm) data = s.forward_sample(int(1e4)) score = BDeuScore(data=data, equivalent_sample_size=100) # The size can be specified here est = HillClimbSearch(data) dag = est.estimate(scoring_method=score)
Hi all, I'm new to the library and PGMs. I'm having 2 concerns as described below related to the BIC score and graph comparison.
I have a dataset of 1000 samples and it is created using graph (I->S), (I->G) (Consider this as the ground truth G*). Then using that dataset, I found scores for 2 graphs as :
print('bic ', BicScore(student_df).score(BayesianModel([['I','G'], ['I','S']])))
print('bic ', BicScore(student_df).score(BayesianModel([['I','G'], ['I','S'],['S','G']])))
I received scores as :
My questions are ;
is_iequivalentBut, I'm getting an unexpected results as highlited in figure. I was expecting G2 to be not an I-equivalent graph of G, because of diferent skeleton (here I'm getting True). I 'm aware that same skeleton and same V-structure are required to be an I-equivlaent graph. But, this result seems to be a little bit confusing to me. I would highly appreciate any help to understand this. May be is it something wrong with my code ? Thanks ! https://drive.google.com/file/d/16f_IUfrpvsCVt-1PjfX23SDeg3psO7AV/view?usp=sharing
state_namesworks theoretically however? When you fit with a state name does it only fit with one such situation of all of the names
state_namesare present in the data otherwise marks a
0as the frequency for the missing states.
@ankurankan hello, I'm trying to learn parameters from DBN, so I follow your DBN fit function example, but I got some problem:
AttributeError: 'DynamicBayesianNetwork' object has no attribute 'fit'
so i means that the fit function can not work now, though DBN class has the source code of fit function?
E_Svariables in the 0th time slice as well. And since they are all endogenous variables, doing the modification should result in an equivalent model.