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

'ContinuousFactor' object has no attribute 'cdf' #29

Open
HitosVilla opened this issue Jan 30, 2019 · 1 comment
Open

'ContinuousFactor' object has no attribute 'cdf' #29

HitosVilla opened this issue Jan 30, 2019 · 1 comment

Comments

@HitosVilla
Copy link

When I try to run this code:

std_normal_pdf = lambda x : np.exp(-xx/2) / (np.sqrt(2np.pi))
std_normal = ContinuousFactor(['x'],std_normal_pdf)
std_normal.discretize(RoundingDiscretizer, low=-3, high=3, cardinality=12)

I obtain the following error:


AttributeError Traceback (most recent call last)
in
1 std_normal_pdf = lambda x : np.exp(-xx/2) / (np.sqrt(2np.pi))
2 std_normal = ContinuousFactor(['x'],std_normal_pdf)
----> 3 std_normal.discretize(RoundingDiscretizer, low=-3, high=3, cardinality=12)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pgmpy\factors\continuous\ContinuousFactor.py in discretize(self, method, *args, **kwargs)
178 # TODO: finish this
179 """
--> 180 return method(self, *args, **kwargs).get_discrete_values()
181
182 def reduce(self, values, inplace=True):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pgmpy\factors\continuous\discretize.py in get_discrete_values(self)
131
132 # for x=[low]
--> 133 discrete_values = [self.factor.cdf(self.low + step/2) - self.factor.cdf(self.low)]
134
135 # for x=[low+step, low+2*step, ........., high-step]

AttributeError: 'ContinuousFactor' object has no attribute 'cdf'

Thank you

@ankurankan
Copy link
Member

@HitosVilla Is this somewhere in the examples? Because we currently have very limited support for continuous variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants