| 1 | diff --git a/sklearn/neighbors/nca.py b/sklearn/neighbors/nca.py |
| 2 | --- a/sklearn/neighbors/nca.py |
| 3 | +++ b/sklearn/neighbors/nca.py |
| 4 | @@ -13,6 +13,7 @@ |
| 5 | import numpy as np |
| 6 | import sys |
| 7 | import time |
| 8 | +import numbers |
| 9 | from scipy.optimize import minimize |
| 10 | from ..utils.extmath import softmax |
| 11 | from ..metrics import pairwise_distances |
| 12 | @@ -299,7 +300,8 @@ def _validate_params(self, X, y): |
| 13 | |
| 14 | # Check the preferred dimensionality of the projected space |
| 15 | if self.n_components is not None: |
| 16 | - check_scalar(self.n_components, 'n_components', int, 1) |
| 17 | + check_scalar( |
| 18 | + self.n_components, 'n_components', numbers.Integral, 1) |
| 19 | |
| 20 | if self.n_components > X.shape[1]: |
| 21 | raise ValueError('The preferred dimensionality of the ' |
| 22 | @@ -318,9 +320,9 @@ def _validate_params(self, X, y): |
| 23 | .format(X.shape[1], |
| 24 | self.components_.shape[1])) |
| 25 | |
| 26 | - check_scalar(self.max_iter, 'max_iter', int, 1) |
| 27 | - check_scalar(self.tol, 'tol', float, 0.) |
| 28 | - check_scalar(self.verbose, 'verbose', int, 0) |
| 29 | + check_scalar(self.max_iter, 'max_iter', numbers.Integral, 1) |
| 30 | + check_scalar(self.tol, 'tol', numbers.Real, 0.) |
| 31 | + check_scalar(self.verbose, 'verbose', numbers.Integral, 0) |
| 32 | |
| 33 | if self.callback is not None: |
| 34 | if not callable(self.callback): |