MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / _validate_for_predict

Method _validate_for_predict

python/thundersvm/thundersvm.py:269–284  ·  view source on GitHub ↗
(self, X)

Source from the content-addressed store, hash-verified

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)

Callers 3

predictMethod · 0.95
predict_probaMethod · 0.95
decision_functionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected