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

Method _sparse_predict

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

Source from the content-addressed store, hash-verified

343 return self.predict_label
344
345 def _sparse_predict(self, X):
346 self.predict_label_ptr = (c_float * X.shape[0])()
347 data = (c_float * X.data.size)()
348 data[:] = X.data
349 indices = (c_int * X.indices.size)()
350 indices[:] = X.indices
351 indptr = (c_int * X.indptr.size)()
352 indptr[:] = X.indptr
353 thundersvm.sparse_predict(
354 X.shape[0], data, indptr, indices,
355 c_void_p(self.model),
356 self.predict_label_ptr, self.verbose)
357
358 self.predict_label = np.frombuffer(self.predict_label_ptr, dtype=np.float32)
359 return self.predict_label
360
361 def decision_function(self, X):
362 X = self._validate_for_predict(X)

Callers 1

predict_probaMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected