(self, X)
| 267 | self.n_classes = n_classes[0] |
| 268 | |
| 269 | def _validate_for_predict(self, X): |
| 270 | # check_is_fitted(self, 'support_') |
| 271 | sparse = sp.isspmatrix(X) |
| 272 | self._sparse = sparse and not callable(self.kernel) |
| 273 | X = check_array(X, accept_sparse='csr', dtype=np.float64, order="C") |
| 274 | if self._sparse and not sp.isspmatrix(X): |
| 275 | X = sp.csr_matrix(X) |
| 276 | if self._sparse: |
| 277 | X.sort_indices() |
| 278 | |
| 279 | if sp.issparse(X) and not self._sparse and not callable(self.kernel): |
| 280 | raise ValueError( |
| 281 | "cannot use sparse input in %r trained on dense data" |
| 282 | % type(self).__name__) |
| 283 | |
| 284 | return X |
| 285 | |
| 286 | def predict(self, X): |
| 287 | X = self._validate_for_predict(X) |
no outgoing calls
no test coverage detected