Closed janluca-drs closed 2 months ago
Hi Luca
Yes, you should be able to use fit
just like you previously used from_samples
. There is no need to use state_names
as well because the models in v1.0.0 no longer keep track of their names. You would just keep track of what index corresponded to what variable name on your end. This change (having everything internally only be indexes as opposed to also trying to keep track of strings) made things significantly simpler internally.
If you want to save the model, you can use torch.save
just like you would with any PyTorch model.
Hi,
Thank you for your work on the package! I am currently updating a project to v1.0 and am having some troubles with Bayesian networks. The documentation here talks about inference from structure being possible and then references a tutorial for that, which I am unable to find.
I would like to replace a call of bn.from_samples(), I guess I can somehow use fit() for that? I'm afraid I am not the most knowledgeable in the topic and the machine learning is more of a sub-module of the project.
I have tried replacing
bn_model = pomegranateBN.from_samples( samples, state_names=keys, algorithm=self.algorithm )
withbn_model = BayesianNetwork(algorithm=self.algorithm)
bn_model.fit(samples)
. Is there a way to replacestate_names
as well asto_dict()
with this solution?Any and all help appreciated, thank you so much!
Best, Luca