正在加载图片...
Journal of Statistical Software 13 svm(formula Species ~.data iris_train,method "C-classification", kernel "radial",cost =10,gamma =0.1) Parameters: SVM-Type: C-classification SVM-Kernel: radial cost: 10 gamma:0.1 Number of Support Vectors: 27 (12123) Number of Classes: 3 Levels: setosa versicolor virginica We can visualize a 2-dimensional projection of the data with highlighting classes and support vectors (see Figure 2): plot(model,iris_train,Petal.Width~ Petal.Length,slice list(Sepal.Width 3, Sepal.Length =4)) Predictions from the model,as well as decision values from the binary classifiers,are obtained using the predict()method: (pred <-predict(model,head(iris),decision.values TRUE)) [1]setosasetosa setosa setosa setosasetosa Levels:setosa versicolor virginica attr(pred,"decision.values") virginica/versicolor virginica/setosa 1 -3.833133 -1.156482 2 -3.751235 -1.121963 -3.540173 -1.177779 ¥ -3.491439 -1.153052 5 -3.657509 -1.172285 6 -3.702492 -1.069637 versicolor/setosa 1 -1.393419 2 -1.279886 3 -1.456532Journal of Statistical Software 13 svm(formula = Species ~ ., data = iris_train, method = "C-classification", + kernel = "radial", cost = 10, gamma = 0.1) Parameters: SVM-Type: C-classification SVM-Kernel: radial cost: 10 gamma: 0.1 Number of Support Vectors: 27 ( 12 12 3 ) Number of Classes: 3 Levels: setosa versicolor virginica We can visualize a 2-dimensional projection of the data with highlighting classes and support vectors (see Figure 2): > plot(model, iris_train, Petal.Width ~ + Petal.Length, slice = list(Sepal.Width = 3, + Sepal.Length = 4)) Predictions from the model, as well as decision values from the binary classifiers, are obtained using the predict() method: > (pred <- predict(model, head(iris), decision.values = TRUE)) [1] setosa setosa setosa setosa setosa setosa Levels: setosa versicolor virginica > attr(pred, "decision.values") virginica/versicolor virginica/setosa 1 -3.833133 -1.156482 2 -3.751235 -1.121963 3 -3.540173 -1.177779 4 -3.491439 -1.153052 5 -3.657509 -1.172285 6 -3.702492 -1.069637 versicolor/setosa 1 -1.393419 2 -1.279886 3 -1.456532
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有