I can do well on it with sklearn's SVC. But How to get it from the CUML version SVC? Because I can't even get the coef_ from the fitted model. And there is no official examples on it. Thanks.
To visualise the decision boundary in 2D you don't need to access the coefficients. You could get the decision values over a 2D grid, and use plt.contourf
to trace out the contours of that 2D landscape. See here and here for two reproducible examples I've previously authored.
Update: OP confirms you can use sklearn.inspection.DecisionBoundaryDisplay
, which has a simpler interface (docs recommend DecisionBoundaryDisplay.from_estimator()
specifically).
In relation to the coef_
attribute specifically for cuml.svm.LinearSVC
, the notes section of the docs says
"[...] in contrast to generic SVC model, it does not compute the support coefficients/vectors".
I've seen code that has from cuml.svm import SVC
, so apparently they have an SVC
implementation although I couldn't find it in their docs (they document an SVR).
If you want the coef_
values you'd need to use SVC(kernel='linear')
, although it's slower than LinearSVC
(at least in the sklearn
implementation; I don't know about cuml
).