[MRG + 1] Fix GaussianProcess batch predict #7329#7330
[MRG + 1] Fix GaussianProcess batch predict #7329#7330jnothman merged 7 commits intoscikit-learn:masterfrom
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.
we should test with eval_MSE=True too.
There was a problem hiding this comment.
@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. |
| y_pred = gp.predict(X) | ||
| y_pred = gp.predict(X, batch_size=1) | ||
| assert_true(np.allclose(y_pred, y)) | ||
| y_pred = gp.predict(X, eval_MSE=True) |
There was a problem hiding this comment.
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.
OK, I will update it ASAP
| y_pred = gp.predict(X) | ||
| assert_true(np.allclose(y_pred, y)) | ||
|
|
||
| def test_batch_size(): |
There was a problem hiding this comment.
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'