Skip to contents

Print Function for FS SVM

Usage

# S3 method for class 'penSVM'
print(x,...)

Arguments

x

model trained by scad or 1norm svm of class PenSVM

...

additional argument(s)

Author

Natalia Becker

See also

Examples


seed<- 123
train<-sim.data(n = 20, ng = 100, nsg = 10, corr=FALSE, seed=seed )
print(str(train)) 
#> List of 3
#>  $ x   : num [1:100, 1:20] 0.249 -1.428 1.301 -2.336 1.537 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:100] "pos1" "pos2" "pos3" "pos4" ...
#>   .. ..$ : chr [1:20] "1" "2" "3" "4" ...
#>  $ y   : Named num [1:20] 1 1 -1 -1 -1 -1 1 1 -1 1 ...
#>   ..- attr(*, "names")= chr [1:20] "1" "2" "3" "4" ...
#>  $ seed: num 123
#> NULL

# for presentation don't check  all lambdas : time consuming! 
model <- scadsvc(as.matrix(t(train$x)), y=train$y, lambda=0.05)
#> [1] "start iterations:"
#> [1] "scad converged in 76 iterations"
print(str(model))
#> List of 9
#>  $ w      : Named num [1:8] 0.302 -0.733 0.252 0.811 -0.377 ...
#>   ..- attr(*, "names")= chr [1:8] "pos2" "bal3" "bal22" "bal27" ...
#>  $ b      : num -0.21
#>  $ xind   : int [1:8] 2 13 32 37 44 70 88 99
#>  $ index  : int [1:20] 1 2 7 8 10 11 13 14 20 3 ...
#>  $ xqx    : num [1:20, 1:20] 2.512 0.63 2.024 0.423 1.109 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : chr [1:20] "1" "2" "3" "4" ...
#>   .. ..$ : chr [1:20] "1" "2" "3" "4" ...
#>  $ fitted : num [1:20] 1.26 2.21 -1.72 -1.14 -1.29 ...
#>  $ type   : num 0
#>  $ lambda1: num 0.05
#>  $ iter   : num 76
#>  - attr(*, "class")= chr [1:2] "scadsvm" "penSVM"
#> NULL

print(model)
#> 
#> Bias =  -0.209625
#> Selected Variables=  pos2 bal3 bal22 bal27 bal34 bal60 bal78 bal89
#> Coefficients:
#>         pos2       bal3      bal22      bal27      bal34      bal60      bal78 
#>  0.3021244 -0.7332790  0.2519414  0.8106146 -0.3768072  0.2973532 -0.5557443 
#>      bal89 
#>  0.2109735 
#>