Description Usage Arguments Value Author(s) References See Also Examples
The function uses x and y to build a multiclass prediction model. The multiclass method can be either one-versus-one (ovo), or one-versus-rest (ovr, default). The probability estimation method for a binary classifier is proposed in Wang et al. (2008), and then we use the method proposed in Wu et al. (2004) to combine the results from binary classifiers in the ovo method. For the ovr method, we rescale those binary probabilities for multiclass problems. The function automatically chooses the best penalty parameter via 5-fold (default) Cross Validations (CV). Linear kernel, polynomial kernel and radial(Gaussian) kernel are available. A solution path is provided by Shin et al. (2012), which boosts the computational speed.
1 2 3 4 |
x |
The x matrix/data.frame for the training dataset. Columns represent the covariates, and rows represent the instances. There should be no NA/NaN values in x. |
y |
The labels for the training dataset. |
fold |
Number of folds in CV. Default 5. |
kernel |
Type of kernel used for learning. |
kparam |
The parameter for the kernel. For linear kernel, this argument is not needed. In polynomial kernel, it represents the degree of the polynomials, and in radial(gaussian) kernel, it represents the usual sigma value. |
Inum |
Number of knots on [0,1] to estimate the class conditional probability. The larger Inum is, the more accurate the final result is, yet the more time it takes to compute. Default |
type |
The type of multiclass method. The option |
lambdas |
The user-specified lambda value vector. Each element should be positive. Default |
All arguments |
All arguments are returned. |
lambdas |
The lambda values used for selecting the best model. Sorted in an increasing order. |
best.lambda |
The best lambda values selected from CV. Used for model prediction. |
call |
The call of |
Chong Zhang, Seung Jun Shin, Junhui Wang, Yichao Wu, Hao Helen Zhang, and Yufeng Liu
Shin, S.J., Y. Wu, and H.H. Zhang (2012). Two-Dimensional Solution Surface for Weighted Support Vector Machines, Journal of Computational and Graphical Statistics, in press.
Wang, J., X. Shen, and Y. Liu (2008). Probability estimation for large margin classifiers. Biometrika 95(1), 149-167.
Wu, T.-F., C.-J. Lin, and R. C. Weng (2004). Probability estimates for multi-class classification by pairwise coupling. Journal of Machine Learning Research 5, 975-1005.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Loading required package: kernlab
$object
$x
Sepal.Length Sepal.Width Petal.Length Petal.Width
1 5.1 3.5 1.4 0.2
2 4.9 3.0 1.4 0.2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.3
120 6.0 2.2 5.0 1.5
$y
[1] setosa setosa setosa setosa setosa setosa
[7] setosa setosa setosa setosa setosa setosa
[13] setosa setosa setosa setosa setosa setosa
[19] setosa setosa versicolor versicolor versicolor versicolor
[25] versicolor versicolor versicolor versicolor versicolor versicolor
[31] versicolor versicolor versicolor versicolor versicolor versicolor
[37] versicolor versicolor versicolor versicolor virginica virginica
[43] virginica virginica virginica virginica virginica virginica
[49] virginica virginica virginica virginica virginica virginica
[55] virginica virginica virginica virginica virginica virginica
Levels: setosa versicolor virginica
$fold
[1] 2
$kernel
[1] "linear"
$kparam
NULL
$Inum
[1] 10
$type
[1] "ovo"
$lambdas
[1] 9.765625e-04 7.812500e-03 6.250000e-02 5.000000e-01 4.000000e+00
[6] 3.200000e+01 2.560000e+02
$best.lambda
[1] 0.0000000000 0.0625000000 0.5000000000 0.0000000000 0.0000000000
[6] 0.0009765625 0.0000000000 0.0000000000 0.0000000000
$call
probsvm(x = iris.x, y = iris.y, fold = 2, Inum = 10, type = "ovo",
lambdas = 2^seq(-10, 10, by = 3))
attr(,"class")
[1] "probsvm"
$new.x
Sepal.Length Sepal.Width Petal.Length Petal.Width
21 5.4 3.4 1.7 0.2
22 5.1 3.7 1.5 0.4
23 4.6 3.6 1.0 0.2
24 5.1 3.3 1.7 0.5
25 4.8 3.4 1.9 0.2
26 5.0 3.0 1.6 0.2
27 5.0 3.4 1.6 0.4
28 5.2 3.5 1.5 0.2
29 5.2 3.4 1.4 0.2
30 4.7 3.2 1.6 0.2
31 4.8 3.1 1.6 0.2
32 5.4 3.4 1.5 0.4
33 5.2 4.1 1.5 0.1
34 5.5 4.2 1.4 0.2
35 4.9 3.1 1.5 0.2
36 5.0 3.2 1.2 0.2
37 5.5 3.5 1.3 0.2
38 4.9 3.6 1.4 0.1
39 4.4 3.0 1.3 0.2
40 5.1 3.4 1.5 0.2
41 5.0 3.5 1.3 0.3
42 4.5 2.3 1.3 0.3
43 4.4 3.2 1.3 0.2
44 5.0 3.5 1.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5.6 2.4
142 6.9 3.1 5.1 2.3
143 5.8 2.7 5.1 1.9
144 6.8 3.2 5.9 2.3
145 6.7 3.3 5.7 2.5
146 6.7 3.0 5.2 2.3
147 6.3 2.5 5.0 1.9
148 6.5 3.0 5.2 2.0
149 6.2 3.4 5.4 2.3
150 5.9 3.0 5.1 1.8
$pred.prob
setosa versicolor virginica
[1,] 0.93011184 0.04619780 0.02369036
[2,] 0.93011184 0.04619780 0.02369036
[3,] 0.93011184 0.04619780 0.02369036
[4,] 0.93011184 0.04619780 0.02369036
[5,] 0.93011184 0.04619780 0.02369036
[6,] 0.93011184 0.04619780 0.02369036
[7,] 0.93011184 0.04619780 0.02369036
[8,] 0.93011184 0.04619780 0.02369036
[9,] 0.93011184 0.04619780 0.02369036
[10,] 0.93011184 0.04619780 0.02369036
[11,] 0.93011184 0.04619780 0.02369036
[12,] 0.93011184 0.04619780 0.02369036
[13,] 0.93011184 0.04619780 0.02369036
[14,] 0.93011184 0.04619780 0.02369036
[15,] 0.93011184 0.04619780 0.02369036
[16,] 0.93011184 0.04619780 0.02369036
[17,] 0.93011184 0.04619780 0.02369036
[18,] 0.93011184 0.04619780 0.02369036
[19,] 0.93011184 0.04619780 0.02369036
[20,] 0.93011184 0.04619780 0.02369036
[21,] 0.93011184 0.04619780 0.02369036
[22,] 0.93011184 0.04619780 0.02369036
[23,] 0.93011184 0.04619780 0.02369036
[24,] 0.93011184 0.04619780 0.02369036
[25,] 0.93011184 0.04619780 0.02369036
[26,] 0.93011184 0.04619780 0.02369036
[27,] 0.93011184 0.04619780 0.02369036
[28,] 0.93011184 0.04619780 0.02369036
[29,] 0.93011184 0.04619780 0.02369036
[30,] 0.93011184 0.04619780 0.02369036
[31,] 0.02352279 0.13462075 0.84185646
[32,] 0.02369111 0.93010494 0.04620395
[33,] 0.02354506 0.84184021 0.13461473
[34,] 0.02369111 0.93010494 0.04620395
[35,] 0.02369111 0.93010494 0.04620395
[36,] 0.02369111 0.93010494 0.04620395
[37,] 0.02369111 0.93010494 0.04620395
[38,] 0.02369111 0.93010494 0.04620395
[39,] 0.02369111 0.93010494 0.04620395
[40,] 0.02369111 0.93010494 0.04620395
[41,] 0.02369111 0.93010494 0.04620395
[42,] 0.02369111 0.93010494 0.04620395
[43,] 0.02369111 0.93010494 0.04620395
[44,] 0.02370091 0.04619651 0.93010258
[45,] 0.02369111 0.93010494 0.04620395
[46,] 0.02369111 0.93010494 0.04620395
[47,] 0.02369111 0.93010494 0.04620395
[48,] 0.02369111 0.93010494 0.04620395
[49,] 0.02369111 0.93010494 0.04620395
[50,] 0.02369111 0.93010494 0.04620395
[51,] 0.02369111 0.93010494 0.04620395
[52,] 0.02369111 0.93010494 0.04620395
[53,] 0.02369111 0.93010494 0.04620395
[54,] 0.04009379 0.91410804 0.04579816
[55,] 0.02369111 0.93010494 0.04620395
[56,] 0.02369111 0.93010494 0.04620395
[57,] 0.02369111 0.93010494 0.04620395
[58,] 0.02369111 0.93010494 0.04620395
[59,] 0.04724306 0.92484561 0.02791132
[60,] 0.02369111 0.93010494 0.04620395
[61,] 0.02370091 0.04619651 0.93010258
[62,] 0.02370091 0.04619651 0.93010258
[63,] 0.02370091 0.04619651 0.93010258
[64,] 0.02370091 0.04619651 0.93010258
[65,] 0.02370091 0.04619651 0.93010258
[66,] 0.02370091 0.04619651 0.93010258
[67,] 0.02352279 0.13462075 0.84185646
[68,] 0.02370091 0.04619651 0.93010258
[69,] 0.02370091 0.04619651 0.93010258
[70,] 0.02370091 0.04619651 0.93010258
[71,] 0.02370091 0.04619651 0.93010258
[72,] 0.02370091 0.04619651 0.93010258
[73,] 0.02370091 0.04619651 0.93010258
[74,] 0.02370091 0.04619651 0.93010258
[75,] 0.02370091 0.04619651 0.93010258
[76,] 0.02370091 0.04619651 0.93010258
[77,] 0.02370091 0.04619651 0.93010258
[78,] 0.02370091 0.04619651 0.93010258
[79,] 0.02352279 0.13462075 0.84185646
[80,] 0.02370091 0.04619651 0.93010258
[81,] 0.02370091 0.04619651 0.93010258
[82,] 0.02370091 0.04619651 0.93010258
[83,] 0.02370091 0.04619651 0.93010258
[84,] 0.02370091 0.04619651 0.93010258
[85,] 0.02370091 0.04619651 0.93010258
[86,] 0.02370091 0.04619651 0.93010258
[87,] 0.02370091 0.04619651 0.93010258
[88,] 0.02370091 0.04619651 0.93010258
[89,] 0.02370091 0.04619651 0.93010258
[90,] 0.02370091 0.04619651 0.93010258
$pred.y
[1] "setosa" "setosa" "setosa" "setosa" "setosa"
[6] "setosa" "setosa" "setosa" "setosa" "setosa"
[11] "setosa" "setosa" "setosa" "setosa" "setosa"
[16] "setosa" "setosa" "setosa" "setosa" "setosa"
[21] "setosa" "setosa" "setosa" "setosa" "setosa"
[26] "setosa" "setosa" "setosa" "setosa" "setosa"
[31] "virginica" "versicolor" "versicolor" "versicolor" "versicolor"
[36] "versicolor" "versicolor" "versicolor" "versicolor" "versicolor"
[41] "versicolor" "versicolor" "versicolor" "virginica" "versicolor"
[46] "versicolor" "versicolor" "versicolor" "versicolor" "versicolor"
[51] "versicolor" "versicolor" "versicolor" "versicolor" "versicolor"
[56] "versicolor" "versicolor" "versicolor" "versicolor" "versicolor"
[61] "virginica" "virginica" "virginica" "virginica" "virginica"
[66] "virginica" "virginica" "virginica" "virginica" "virginica"
[71] "virginica" "virginica" "virginica" "virginica" "virginica"
[76] "virginica" "virginica" "virginica" "virginica" "virginica"
[81] "virginica" "virginica" "virginica" "virginica" "virginica"
[86] "virginica" "virginica" "virginica" "virginica" "virginica"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.