-
Notifications
You must be signed in to change notification settings - Fork 694
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
Variable naming inconsistency? #961
Comments
Error corrected : On line 78, 79 of LinearGaussianCPD.py, please put self.variables instead of variables. |
@Arijit-hydrated Thanks for reporting this. Sure, if you would like to fix this, please create a pull request. |
I meet the same bug, so this bug has not been fixed in the current version(0.1.11) ? |
@JZQ-Coder No, it's not fixed it. |
@JZQ-Coder The fix is simple and code changes are in this PR #962. I found it and sent out a PR to fix it 3 years ago |
Glad to hear from you,I changed the source code as you prompted
But there is another issuse,when i run the code
Then,I find predict method has not been implemented by LinearGaussianBayesianNetWork.
So can you tell me if pgmpy support Continuous variable Bayesian network in v 0.1.11?
If it can do it,please give me a example.
Looking forward to hearing from you
…------------------ 原始邮件 ------------------
发件人: "pgmpy/pgmpy" <notifications@github.com>;
发送时间: 2020年9月29日(星期二) 上午10:57
收件人: "pgmpy/pgmpy"<pgmpy@noreply.github.com>;
抄送: "等风"<643187458@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [pgmpy/pgmpy] Variable naming inconsistency? (#961)
@JZQ-Coder The fix is simple and code changes are in this PR #962. I found it and sent out a PR to fix it 3 years ago
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@JZQ-Coder No, continuous variables are not completely supported. Continuous variables/ LinearGaussianCPDs are not completely integrated with all parts of the package, so you will run into errors. |
This was causing a compilation error when declaring LinearGaussianCPDs and adding it to a LinearGaussianBayesianNetwork model
This was causing a compilation error when declaring LinearGaussianCPDs and adding it to a LinearGaussianBayesianNetwork model
This was causing a compilation error when declaring LinearGaussianCPDs and adding it to a LinearGaussianBayesianNetwork model
This was causing a compilation error when declaring LinearGaussianCPDs and adding it to a LinearGaussianBayesianNetwork model
Subject of the issue
In line 54, 55 of pgmpy/pgmpy/models/LinearGaussianBayesianNetwork.py, cpd.variables has been checked for, whereas, line 66 of pgmpy/pgmpy/factors/continuous/LinearGaussianCPD.py has self.variable specified and not variables. Hence, I think that this error is being raised. Highly obliged if you look into it.
Your environment
Steps to reproduce
from pgmpy.models import *
model = LinearGaussianBayesianNetwork([('hist_dist', 'dist_relevance'),('curr_dist', 'dist_relevance'),('monthly_exp','offer_interest'),('cat_merchant_affinity','offer_interest'),
('offer_interest','offer_hit_effect'),('dist_relevance','offer_hit_effect')])
model.add_nodes_from(['hist_dist', 'curr_dist', 'dist_relevance','monthly_exp','cat_merchant_affinity','offer_interest','offer_hit_effect'])
from pgmpy.factors.continuous import LinearGaussianCPD
hist_dist_cpd = LinearGaussianCPD('hist_dist', [200], 20)
curr_dist_cpd = LinearGaussianCPD('curr_dist', [400], 50)
dist_rel_cpd = LinearGaussianCPD('dist_relevance', [0, 0.5, 0.5], 0.1, ['hist_dist', 'curr_dist'])
monthly_exp_cpd = LinearGaussianCPD('monthly_exp', [45000], 5000)
cat_merchant_cpd = LinearGaussianCPD('cat_merchant_affinity', [0.6], 0.2)
offer_interest_cpd = LinearGaussianCPD('offer_interest', [0, 0.7, 0.3], 0.1, ['monthly_exp', 'cat_merchant_affinity'])
offer_hit_effect_cpd = LinearGaussianCPD('offer_hit_effect', [0.1, 0.3, 0.6], 0.2, ['dist_relevance', 'offer_interest'])
model.add_cpds(hist_dist_cpd, curr_dist_cpd, dist_rel_cpd, monthly_exp_cpd, cat_merchant_cpd, offer_interest_cpd, offer_hit_effect_cpd)
Expected behaviour
No error
Actual behaviour
File "linearGaussian.py", line 25, in
model.add_cpds(hist_dist_cpd, curr_dist_cpd, dist_rel_cpd, monthly_exp_cpd, cat_merchant_cpd, offer_interest_cpd, offer_hit_effect_cpd)
File "/usr/local/lib/python3.4/dist-packages/pgmpy-0.1.6-py3.4.egg/pgmpy/models/LinearGaussianBayesianNetwork.py", line 54, in add_cpds
if set(cpd.variables) - set(cpd.variables).intersection(
AttributeError: 'LinearGaussianCPD' object has no attribute 'variables'
The text was updated successfully, but these errors were encountered: