-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG + 1] Fix GaussianProcess batch predict #7329 #7330
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
Conversation
You should also modify this line. Otherwise LGTM |
@TomDLT Thanks, I have fix it. |
LGTM. The test failed on master? I guess because the dataset is small the test is not overly slow (batch_size=1 seems extreme) |
@amueller I test on 0.17.1 and it will fail with batch_size=1. If batch_size=1 is extreme, what about setting |
@zhengruifeng no that's ok, I think. Other reviews? |
@@ -129,7 +129,7 @@ def test_ordinary_kriging(): | |||
|
|||
def test_no_normalize(): | |||
gp = GaussianProcess(normalize=False).fit(X, y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should test with eval_MSE=True
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhengruifeng your fix looks fine. Can you follow @jnothman suggestion about the test?
If I were you I would leave test_no_normalize
unmodified and just add a test function like this:
def test_batch_size():
# TypeError when using batch_size on Python 3, see
# https://github.com/scikit-learn/scikit-learn/issues/7329 for more
# details
gp = GaussianProcess()
gp.fit(X, y)
gp.predict(X, batch_size=1)
gp.predict(X, batch_size=1, eval_MSE=True)
@zhengruifeng Are you completing this fix, or should someone else? |
f6d8177
to
c73a6f1
Compare
@jnothman I add the test with |
Thanks. I'll look later. In the meantime, you've got test failures. |
assert_true(np.allclose(y_pred, y)) | ||
y_pred = gp.predict(X, eval_MSE=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As suggested by @lesteve, this doesn't belong in test_no_normalize
. Make a new test for batch_size
only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will update it ASAP
@@ -132,6 +132,14 @@ def test_no_normalize(): | |||
y_pred = gp.predict(X) | |||
assert_true(np.allclose(y_pred, y)) | |||
|
|||
def test_batch_size(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8: insert another blank line
Thanks! |
…ikit-learn#7330) * fix batch * add test for eval_MSE
…ikit-learn#7330) * fix batch * add test for eval_MSE
…ikit-learn#7330) * fix batch * add test for eval_MSE
Reference Issue
Fix #7329
GaussianProcess batch predict fail on py3 due to range(float)
What does this implement/fix? Explain your changes.
1,add a int() to convert float to int for py3
2,add a test for 'batch_size'