ipop-class.RdThe quadratic problem solver class
Objects can be created by calls of the form new("ipop", ...).
or by calling the ipop function.
primal:Object of class "vector" the primal
solution of the problem
dual:Object of class "numeric" the dual of the
problem
how:Object of class "character" convergence information
signature(object = "ipop"): Return the primal of
the problem
signature(object = "ipop"): Return the dual of
the problem
signature(object = "ipop"): Return information on
convergence
## solve the Support Vector Machine optimization problem
data(spam)
## sample a scaled part (300 points) of the spam data set
m <- 300
set <- sample(1:dim(spam)[1],m)
x <- scale(as.matrix(spam[,-58]))[set,]
y <- as.integer(spam[set,58])
y[y==2] <- -1
##set C parameter and kernel
C <- 5
rbf <- rbfdot(sigma = 0.1)
## create H matrix etc.
H <- kernelPol(rbf,x,,y)
c <- matrix(rep(-1,m))
A <- t(y)
b <- 0
l <- matrix(rep(0,m))
u <- matrix(rep(C,m))
r <- 0
sv <- ipop(c,H,A,b,l,u,r)
primal(sv)
#> [1] 1.016212669 0.589201471 1.173879729 1.067668601 0.188365185 0.198934496
#> [7] 0.889219183 0.705486093 0.225535159 1.003560444 1.019647737 1.000472209
#> [13] 0.829880454 0.114980332 0.501935657 0.711501895 1.104790762 0.640872858
#> [19] 0.574891902 3.299016515 0.158008608 0.606225876 0.444475504 1.158624138
#> [25] 0.355898402 0.116072219 0.627549979 0.288217345 0.127208507 1.586148577
#> [31] 0.367822099 0.389379114 0.558671763 0.139034068 1.328583752 0.860994032
#> [37] 0.523501330 0.236336106 4.906595934 1.071190790 0.167564332 0.861085031
#> [43] 0.060822612 2.058722931 0.114979942 0.284164885 0.613818543 0.232909565
#> [49] 1.072217786 0.582934640 0.239572456 0.078526900 0.311193356 0.443751281
#> [55] 0.084614855 0.432963222 2.066705512 0.765123174 0.494249944 0.520911264
#> [61] 0.035743713 0.969368671 0.234708539 0.119790441 0.729858674 4.141224500
#> [67] 0.405986563 0.111635261 0.715853024 2.643948937 0.279389494 1.150103992
#> [73] 0.823396096 2.104139590 0.975360475 2.063199241 0.877526588 0.446732163
#> [79] 0.580981030 4.824544643 3.693358063 0.993630078 3.791237558 0.873821194
#> [85] 0.902625197 1.018681341 1.350588587 0.894946126 0.952558483 0.454886645
#> [91] 0.820814990 0.641933583 1.144349851 1.393555798 0.103352942 0.852080771
#> [97] 0.238241479 0.627975810 1.201514647 0.232283356 0.422504736 1.011656699
#> [103] 0.905140096 0.277051086 0.231450269 0.003337960 0.410233276 0.524670149
#> [109] 0.612391167 2.702891712 0.029757709 1.193916135 1.040477069 1.232341153
#> [115] 1.225557655 0.923490526 0.987018410 0.700089094 0.387880372 1.029303354
#> [121] 0.519544461 0.443175466 0.617289988 1.952736309 1.097508470 0.795443666
#> [127] 0.335620891 1.217545450 0.942037677 1.604735624 0.683136956 0.858096699
#> [133] 1.202215468 0.065422699 0.662227830 0.751163241 0.353403023 0.948739841
#> [139] 1.357280349 0.663096656 0.891335154 0.217234073 0.558452376 1.063809756
#> [145] 0.278384710 1.000923636 1.971868267 1.182926845 2.105167363 1.701181822
#> [151] 1.050646220 0.200297831 0.143380085 0.368600585 0.174763202 0.094195140
#> [157] 1.069262301 0.381882161 1.026349648 0.424153021 1.790223910 1.081985700
#> [163] 1.106004538 0.085826400 0.205928942 0.103189003 0.578130966 0.125268208
#> [169] 0.960122199 0.685774656 0.271088281 0.096402389 0.295559980 0.896775118
#> [175] 0.541362379 0.833308632 4.775864027 0.950834225 0.032774917 0.973608821
#> [181] 0.067735582 0.169945408 1.035095622 0.581323523 1.058278175 1.037058657
#> [187] 0.937938912 1.070559014 1.120237381 1.503004150 1.870191277 0.083606360
#> [193] 1.229271423 0.221247569 0.818953471 1.692798497 0.199382779 1.850382126
#> [199] 1.414452792 1.475345461 1.022419576 0.925792902 0.958355331 0.127072734
#> [205] 0.126675651 0.825976268 2.093537987 1.071514610 0.009431718 1.170599315
#> [211] 0.526712796 0.333951637 0.930375758 1.016808797 0.606044565 1.061725956
#> [217] 0.600011859 1.071575716 1.075040661 0.312802461 0.758403875 0.057924757
#> [223] 0.097363579 1.123875038 0.742596873 0.096984110 1.174167580 0.337026141
#> [229] 1.071545228 1.284126051 0.335953653 0.677259001 1.071573556 0.308932163
#> [235] 0.121112241 0.392337902 0.813343130 1.059381309 0.228185140 1.040327042
#> [241] 1.071575716 0.097307121 1.249386036 0.884108582 0.404966070 0.149763728
#> [247] 2.357315036 0.298803596 0.843898136 1.118446897 0.317988602 0.157734314
#> [253] 0.234791245 0.829449099 1.231883944 0.060039177 0.302897914 1.711108298
#> [259] 0.208948374 1.043784704 1.079430027 2.467242359 0.493225793 0.643652232
#> [265] 1.161918813 0.759759207 0.753022586 0.305396717 0.953839182 1.068877444
#> [271] 2.448281298 1.170597477 1.071575716 0.235967917 0.949865903 0.231250213
#> [277] 0.460772857 0.995359333 0.960481396 0.151300509 0.896589029 1.017262531
#> [283] 0.963214978 1.210641800 0.872876974 0.940705093 1.070191695 0.889231841
#> [289] 0.947150779 0.031330742 0.657931225 0.551606632 0.723848825 0.305338203
#> [295] 0.319146056 1.059095399 0.163473212 1.551790199 1.092006883 1.170589198
dual(sv)
#> [1] -0.07744301
how(sv)
#> [1] "slow convergence, change bound?"