Open EsqYu opened 5 days ago
BicScore also only works with discretized data. Currently, structural learning can only be done on discretized data, while parameters learning can be done on initial data without discretization.
Thank you for your reply. Then, if I want to apply BAMT on mixed or continuous data without discretization, all I can do is parameters learning? When I only do parameters learning, just execute bn.fit_parameters()?
Yes, parameters learning you can apply without discretization via function bn.fit_parameters().
Thank you. I'm just wondering how I can do parameters learning without structure learning. In that case, should I use other algorithm and determine the structure and then use this bn.fit_parameters?
The structure must be specified anyway in a Bayesian network, this can be done by simply passing a list of edges to the method bn.set_structure(edges=structure). Parametric training can then be run as before bn.fit_parameters. There is an example in the documentation https://bamt.readthedocs.io/en/latest/examples/read_structure_param_learning.html
Hi.
I wonder how I can use BIC score instead of K2 score in the add_edges method. I executed the code below, changing scoring function since K2 score seems to be used only in a case that all the variables are discretized. However, it didn't work and the error message says "Hybrid BN does not support continuous data".
from pgmpy.estimators import BicScore hybrid_bn = HybridBN(has_logit=False, use_mixture=True) hybrid_bn.add_edges(data, scoring_function=("Bic",BicScore)) hybrid_bn.fit_parameters(data)