Skip to content

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

Open
@HitosVilla

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions