Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BNLikelihood.compute error "AttributeError: type object 'BayesianNetwork' has no attribute 'from_samples'" #642

Open
franz3000 opened this issue Oct 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@franz3000
Copy link

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDMetrics version: 0.16.0
  • Python version: 3.10.15
  • Operating System: ubuntu-24.04.1-desktop-amd64

Actual version of SDV: 1.17.0
Actual version of SDMetrics: 0.16.0
Actual version of Pomegranate: 1.0.0

PyCharm 2024.2.3 (Professional Edition)
Build #PY-242.23339.19, built on September 25, 2024
Virtual Environment

Error Description

AttributeError: type object 'BayesianNetwork' has no attribute 'from_samples'

Steps to reproduce

bnLikelihood = BNLikelihood.compute(real_data=real_data,synthetic_data=synthetic_data)
print (bnLikelihood,"BNLikelihood on data set (categorical colmuns only considered")

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Traceback (most recent call last):
  File "/home/franz/PycharmProjects/SDV_Metrics/Evaluate/evaluate_sdv_metrics.py", line 207, in <module>
    bnLikelihood = BNLikelihood.compute(real_data=real_data,synthetic_data=synthetic_data)
  File "/home/franz/PycharmProjects/SDV_Metrics/.venv/lib/python3.10/site-packages/sdmetrics/single_table/bayesian_network.py", line 125, in compute
    return np.mean(cls._likelihoods(real_data, synthetic_data, metadata, structure))
  File "/home/franz/PycharmProjects/SDV_Metrics/.venv/lib/python3.10/site-packages/sdmetrics/single_table/bayesian_network.py", line 43, in _likelihoods
    bn = BayesianNetwork.from_samples(real_data[fields].to_numpy(), algorithm='chow-liu')
@franz3000 franz3000 added bug Something isn't working new Label applied to new issues labels Oct 10, 2024
@srinify
Copy link

srinify commented Oct 11, 2024

Hi @franz3000 I was able to reproduce this issue. It's clear that SDMetrics is calling code from pomegranate that's no longer valid in more recent versions of that library but I also couldn't identify a specific, recent-enough version of pomegranate that would still work with our SDMetrics code.

With all of this in mind, I'm going to open a new issue for the team to determine the best path forward!

@srinify srinify removed the new Label applied to new issues label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants