Kernlab Error in .local(x, ...) when plot model

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Kernlab Error in .local(x, ...) when plot model

Dear all,
I have generated a model with KERNLAB using the following steps:
the data is a dataframe df of two numerical variables x and y, and
each point is assigned a z value that is a factor of two levels:
positive and negative. The data has the strucutre:
> str(df)
'data.frame': 1574 obs. of 3 variables:
$y : num ...
$x : num ...
$x : Factor w/ 2 levels "negative", "positive"...

I set the model with:
mod = ksvm(z ~., data = df, type = "C-bscv", kernel = "rbfdot", kpar =
"automatic", C = 10, prob.model  = TRUE)
which gives me:
> mod
Support Vector Machine object of class "ksvm"

SV type: S-bsvc (classification)
parameter: cost  C = 10
Gaussian Radial basis kernel function.
Hyperparameter: sigma = 45.69...

Number of support vectors: 1436

Objective function value : -12792.1
Training error: 0.388818
Probability model included

But when I try to plot the model I get:
>plot(mod, data = df) OR kernlab::plot(mod, data = df)
Error in .local(x, ...) :
Only plots of classification ksvm object supported

What did I get wrong?
Thank you

Best regards,

[hidden email] mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.