Skip to content

GaussianProcess with batch_size gives "'float' object cannot be interpreted as an integer" #6483

@stmax82

Description

@stmax82
Windows-10-10.0.10586
Python 3.4.4 |Continuum Analytics, Inc.| (default, Jan 29 2016, 15:20:20) [MSC v.1600 64 bit (AMD64)]
NumPy 1.10.4
SciPy 0.17.0
Scikit-Learn 0.17.1

The following code:

import numpy as np
from sklearn.gaussian_process import GaussianProcess

X = np.random.rand(100, 3)
y = np.random.rand(100)

gp = GaussianProcess().fit(X, y)

gp.predict(X, batch_size=5)

Results in the error

'float' object cannot be interpreted as an integer

Because of:

C:\...\lib\site-packages\sklearn\gaussian_process\gaussian_process.py in predict(self, X, eval_MSE, batch_size)
    520 
    521                 y = np.zeros(n_eval)
--> 522                 for k in range(max(1, n_eval / batch_size)):
    523                     batch_from = k * batch_size
    524                     batch_to = min([(k + 1) * batch_size + 1, n_eval + 1])

TypeError: 'float' object cannot be interpreted as an integer

Metadata

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