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

Fixes Docset for Discretize PR#742 #820

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Conversation

kris-singh
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Jan 12, 2017

Coverage Status

Coverage increased (+0.02%) to 96.192% when pulling 3027625 on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

@yashu-seth
Copy link
Member

@kris-singh Just fixing doc-tests will not suffice. Discretize methods for ContinuousFactor has not been implemented.

@yashu-seth
Copy link
Member

@kris-singh You need to add tests for the changes you have made.

@kris-singh
Copy link
Contributor Author

@yashu-seth I was looking for the tests of Discretize methods i couldn't find them. Also, do you have any references for discretizing of multivariable Continuos Factors

@yashu-seth
Copy link
Member

@kris-singh You have added the functionality to discretize univariate ContinuousFactor right?

@kris-singh
Copy link
Contributor Author

@yashu-seth Yes now discretization works for continuous factor.

@yashu-seth
Copy link
Member

@kris-singh But only for univariate cases. So you will have to add tests for discretize method taking univariate Continuous Factors.

@kris-singh
Copy link
Contributor Author

@yashu-seth can you suggest some test. i was thinking about it. How can we check are we discretizing correctly or not.

@ankurankan
Copy link
Member

@kris-singh You can compute the values of probability at specific points using the pdf and check if you are getting the same values.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 96.241% when pulling 73a60ee on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 96.241% when pulling c77aa6d on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 96.241% when pulling c4e013e on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

@kris-singh
Copy link
Contributor Author

kris-singh commented Jan 21, 2017

@ankurankan @yashu-seth I have added the test.Are they enough? I am not able to understand travis-ci error how can values change when using python 3.4,.5 and python 2.7.

@ankurankan
Copy link
Member

@kris-singh Because there are a lot of changes in the behavior of python 2 and 3. Just look through your changes and see if you can see something that might be behaving differently in python 2 and 3. If are you unable to find something try running a debugger on both 2 and 3 and see where the values start differing. That will help you in locating the bug.

@coveralls
Copy link

coveralls commented Jan 23, 2017

Coverage Status

Coverage increased (+0.2%) to 96.397% when pulling 53808c6 on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 96.397% when pulling 53808c6 on kris-singh:PR#742 into 5240a94 on pgmpy:dev.

@kris-singh
Copy link
Contributor Author

@ankurankan this is ready for review

np.testing.assert_almost_equal(results2, [-2.120911, -0.115055, 0.198042, 0.033288, 0.004727], decimal=4)
np.testing.assert_almost_equal(results3, [0.038335, 0.059015, 0.039992], decimal=4)
np.testing.assert_almost_equal(results3, [0.008325, 0.028291, 0.030074], decimal=4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kris-singh Why did these values change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes made to division made in python3.
for python2.7 i used from future import division

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kris-singh But that does mean that the tests were either wrong earlier or are now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i have to figure this one out. I will check my calculations again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankurankan Yes i checked the calculations. Both python 2.7 and 3.5 give the ans. The only trouble was i wrote 5/2 in python 2.7 gamma(5/2) = 1 if gamma(5.0/2.0) = 1.3293. division in python3.5 are by default are float.

@kris-singh
Copy link
Contributor Author

@ankurankan ready for review

Copy link
Member

@ankurankan ankurankan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kris-singh There is something wrong with the implementation. The discretized values shouldn't be negative as it's a probability distribution.

@kris-singh
Copy link
Contributor Author

@ankurankan i will check the problem out.

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

Successfully merging this pull request may close these issues.

None yet

4 participants