-
-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
GaussianProcess with batch_size gives "'float' object cannot be interpreted as an integer" #6483
Comments
|
oh thanks, I didn't know the GaussianProcess class was deprecated (there's no warning anywhere). Wish I could try the new one in 0.18, but I cannot use dev versions in production. Will there be a 0.17.2 release before 0.18? The fix would be trivial - I think replacing the division "/" by "//" should do it.. |
@glouppe according to the docstring at https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/gaussian_process/gaussian_process.py#L61, it will be deprecated in 0.20. Is this an error in the docstring? |
No, this is correct. The new GP implementation has been added after the 0.17 release, and therefore the old implementation will be deprecated in 0.20, two release cycles after the next 0.18 release.
|
ah that makes sense, thanks for the info. |
Fixes scikit-learn#7329 and scikit-learn#6483 I realize this is deprecated, but in case you're still interested in a quick bugfix, my understanding is that this was previously a silent bug even in Python 2.7. ``` import numpy as np def check_mse(n_eval, batch_size): y, MSE = np.zeros(n_eval), np.zeros(n_eval) for k in range(max(1, n_eval / batch_size)): batch_from = k * batch_size batch_to = min([(k + 1) * batch_size + 1, n_eval + 1]) print batch_from, batch_to def check_mse_fixed(n_eval, batch_size): y, MSE = np.zeros(n_eval), np.zeros(n_eval) for k in range(int(n_eval / float(batch_size) + 0.5)): batch_from = k * batch_size batch_to = min([(k + 1) * batch_size + 1, n_eval + 1]) print batch_from, batch_to check_mse(8, 3) print check_mse_fixed(8, 3) ``` Python 2.7 output: ``` 0 4 3 7 0 4 3 7 6 9 ``` Note 8 corresponds to the sample size so the current version (if converted to an int) would miss the last few samples.
The following code:
Results in the error
Because of:
The text was updated successfully, but these errors were encountered: