smac: Classification function that provides solution path to...

Description Usage Arguments Value Author(s) References See Also Examples

Description

A classifier that works under the structure of MAC (Zhang and Liu, 2014) with linear learning and the L1 penalty for variable selection.

Usage

1
2
3
smac(x,y,loss=c("logistic", "psvm", "boost"),weight=NULL,nlambda = 100,
lambda.min=ifelse(nobs < np, 0.05, 1e-03),lambda = NULL,
standardize = TRUE, epsilon = 1e-05)

Arguments

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.

loss

The binary large margin classifer loss function to be used. By default the program uses the logistic loss. Exponential loss in boosting and squared loss in proximal support vector machines are also available. "l" or "logi" for logistic loss, "b" or "boost" for boosting loss, and "p" or "psvm" for squared loss in proximal support vector machines.

weight

The weight vector for each observation. By default the program uses equal weights for all observations.

nlambda

The number of lambda values in a solution path, if the user does not specify which lambdas to use. Default is 100.

lambda.min

In a classification problem where the user does not provide a list of lambda values, the program will automatically find the smallest lambda value that makes all the estimated parameters 0 as a starting lambda. Then the program will create a solution path for a list of lambda values based on the starting lambda (this starting lambda is in fact the largest lambda in the solution path). This option specifies how small the last lambda is compared to the starting lambda in terms of ratios. By default if the number of observations is larger than the number of parameters, the smallest lambda in the solution path is set to be 1/1,000 of the starting lambda, and is set to be 1/20 otherwise. The program then chooses nlambda's of lambda values between the starting lambda and the last lambda, based on an even split of log(lambda) values.

lambda

The user specified lambda values. If used, the options nlambda and lambda.min will be ignored.

standardize

Whether the input x should be standardized or not. Default is TRUE (standardize).

epsilon

Convergence threshold in coordinate descent circling algorithm. The smaller epsilon is, the more accurate the final model is, and the more time it takes for calculation. Default is 1e-5.

Value

All

All arguments that are used are recorded.

k

Number of classes in the classification problems.

x.name

The column names of x.

y.name

The class names of y.

lambda

The lambda vector of all lambdas in the solution path.

beta0

A list of the intercepts of the classification function. Each vector in the list corresponds to the lambda in the solution path in order.

beta

A list of matrices containing the estimated parameters of the classification function. Each matrix in the list corresponds to the lambda value in the solution path in order. For one single matrix, the rows correspond to a specific predictor, whose name is recorded as the row name. Note that a predictor does not have a significant effect on the label if and only if all elements in its corresponding row are 0.

loss

The loss function used.

way

A numeric value specifying if the user provides the lambda values in the solution path (2), or not (1). This return is mainly used in the prediction function.

call

The call of smac.

Author(s)

Chong Zhang, Guo Xian Yau and Yufeng Liu

References

C. Zhang and Y. Liu (2014). Multicategory Angle-based Large-margin Classification. Biometrika, 101(3), 625-640.

See Also

predict.smac

Examples

1
2
data(ex1.data)
smac(ex1.data$ex1.x,ex1.data$ex1.y,loss="p",nlambda=30)

Example output

$x
             V1          V2
1   -2.03753168  3.41305685
2   -0.94834688  0.95111968
3   -2.98157370  2.93166441
4   -2.26957133  2.59608536
5   -0.39677078  0.65290372
6    0.23953644  0.80329943
7   -2.86952807  3.22810097
8   -0.10376736 -0.45620098
9    4.88516067  3.86602120
10  -0.23094666  0.91275996
11  -3.31001897  3.01860021
12   4.88731863  3.50525299
13  -0.81498485 -0.17932992
14   0.77030524 -0.58456829
15  -3.40327117  3.00718412
16   3.31550409  4.69998566
17  -3.77619789  2.04418357
18  -0.83577972  0.66542090
19  -3.53629060  2.51052796
20  -2.27779063  3.41885352
21  -3.17357921  3.32670543
22  -2.57506221  3.21529170
23  -2.14021754  3.23445293
24   3.60936437  4.19111119
25  -2.52290294  3.35374426
26   0.30822837  0.96009787
27   3.60894214  4.67516427
28  -3.95695067  2.15199091
29  -0.23571041  0.05641552
30   3.50596001  3.32396811
31  -2.93461237  2.86338984
32  -2.66355720  2.20084772
33  -0.41603571 -0.78887334
34  -3.05812357  3.66332486
35  -0.24084896  0.90804993
36  -0.80011793 -0.19404058
37  -3.64359825  2.73729769
38   4.69002102  3.89655973
39   3.94529355  3.86750450
40   0.75519457  0.92546363
41  -2.31642541  3.48266661
42   3.34719712  3.56257133
43  -2.55080984  2.98199082
44  -3.14713695  3.95690567
45   4.17041309  4.13493229
46   4.53498500  3.15870486
47  -2.14875343  2.11860268
48   4.61226094  4.81244132
49   4.88387458  4.64838286
50  -0.40301945  0.25339640
51  -0.99672736 -0.57220739
52  -0.62034917 -0.30242832
53   4.48673072  3.28273950
54  -2.73003769  2.86277963
55   0.01127342  0.54677403
56   3.05536278  4.81942107
57  -3.87787602  3.65351246
58   3.34207283  4.91158264
59  -2.01173950  2.75296357
60   4.56082501  3.09325581
61   0.04466555 -0.42086236
62  -3.91158124  3.99937630
63  -0.45963145 -0.10249726
64  -0.77016234  0.99006095
65  -2.55454853  3.41490113
66  -0.19027829 -0.40064052
67  -2.22825985  3.81666404
68  -3.23740397  2.94866613
69  -0.14446559  0.63062593
70  -3.92057715  2.50698006
71  -0.10077607  0.91619370
72  -2.61048671  2.92590270
73  -2.38315571  2.26020138
74  -3.69296172  3.54061472
75   0.10501043 -0.71587650
76  -0.12558965  0.08232497
77   0.45737394  0.31500274
78   3.84416232  4.15226327
79  -3.10094720  3.00998232
80  -2.48603516  3.86080826
81   3.49282401  3.45321450
82  -3.05260740  2.02753359
83  -0.54420127 -0.44406453
84   3.89312740  3.62311312
85  -2.19305709  3.80088547
86   4.90202292  4.11482903
87   4.17210732  3.26992208
88  -2.70997112  2.43356802
89   4.88643147  3.16915614
90  -2.53292943  3.71129477
91  -2.09948282  2.11737089
92   0.36514078 -0.34404561
93   3.51681724  4.00039343
94   4.43243048  3.66779213
95  -3.02002729  3.75411273
96   0.81836457  0.76556496
97   4.86869790  4.80222612
98   3.95446222  4.59588471
99  -0.11982533  0.80296454
100  4.19187371  3.88052204

$y
  [1] 2 3 2 2 3 3 2 3 1 3 2 1 3 3 2 1 2 3 2 2 2 2 2 1 2 3 1 2 3 1 2 2 3 2 3 3 2
 [38] 1 1 3 2 1 2 2 1 1 2 1 1 3 3 3 1 2 3 1 2 1 2 1 3 2 3 3 2 3 2 2 3 2 3 2 2 2
 [75] 3 3 3 1 2 2 1 2 3 1 2 1 1 2 1 2 2 3 1 1 2 3 1 1 3 1

$weight
  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

$standardize
[1] TRUE

$epsilon
[1] 1e-05

$k
[1] 3

$x.name
[1] "V1" "V2"

$y.name
[1] 1 2 3

$lambda
 [1] 1.336899449 1.053538639 0.830237207 0.654265344 0.515591371 0.406309863
 [7] 0.320190977 0.252325309 0.198844021 0.156698292 0.123485506 0.097312294
[13] 0.076686591 0.060432583 0.047623672 0.037529658 0.029575107 0.023306553
[19] 0.018366643 0.014473765 0.011405996 0.008988453 0.007083317 0.005581982
[25] 0.004398860 0.003466505 0.002731766 0.002152758 0.001696473 0.001336899

$beta0
$beta0[[1]]
[1] -0.008824764 -0.217473990

$beta0[[2]]
[1] -0.2718275 -0.3063277

$beta0[[3]]
[1] -0.4726017 -0.3531156

$beta0[[4]]
[1] -0.6034806 -0.2919060

$beta0[[5]]
[1] -0.7065811 -0.2435443

$beta0[[6]]
[1] -0.7878291 -0.2054328

$beta0[[7]]
[1] -0.8518562 -0.1753992

$beta0[[8]]
[1] -0.9023126 -0.1517313

$beta0[[9]]
[1] -0.9420745 -0.1330798

$beta0[[10]]
[1] -0.9734087 -0.1183815

$beta0[[11]]
[1] -0.9981015 -0.1067986

$beta0[[12]]
[1] -1.01756055 -0.09767067

$beta0[[13]]
[1] -1.03289519 -0.09047745

$beta0[[14]]
[1] -1.04497960 -0.08480886

$beta0[[15]]
[1] -1.05450268 -0.08034177

$beta0[[16]]
[1] -1.06200733 -0.07682157

$beta0[[17]]
[1] -1.07083376 -0.09313797

$beta0[[18]]
[1] -1.0858385 -0.1584448

$beta0[[19]]
[1] -1.0976625 -0.2099149

$beta0[[20]]
[1] -1.1069931 -0.2504829

$beta0[[21]]
[1] -1.1143347 -0.2824443

$beta0[[22]]
[1] -1.1201311 -0.3076388

$beta0[[23]]
[1] -1.1248303 -0.3280347

$beta0[[24]]
[1] -1.1350228 -0.3699641

$beta0[[25]]
[1] -1.1430721 -0.4030298

$beta0[[26]]
[1] -1.1494065 -0.4290793

$beta0[[27]]
[1] -1.1543887 -0.4495861

$beta0[[28]]
[1] -1.1583240 -0.4657547

$beta0[[29]]
[1] -1.1614118 -0.4784464

$beta0[[30]]
[1] -1.1638769 -0.4885487


$beta
$beta[[1]]
   [,1] [,2]
V1    0    0
V2    0    0

$beta[[2]]
        [,1] [,2]
V1 0.0000000    0
V2 0.1661741    0

$beta[[3]]
        [,1]      [,2]
V1 0.0000000 0.0144413
V2 0.2759836 0.0000000

$beta[[4]]
        [,1]       [,2]
V1 0.0000000 0.08680181
V2 0.2732837 0.00000000

$beta[[5]]
        [,1]      [,2]
V1 0.0000000 0.1439001
V2 0.2710344 0.0000000

$beta[[6]]
        [,1]      [,2]
V1 0.0000000 0.1888962
V2 0.2692617 0.0000000

$beta[[7]]
        [,1]      [,2]
V1 0.0000000 0.2243553
V2 0.2678646 0.0000000

$beta[[8]]
        [,1]      [,2]
V1 0.0000000 0.2522988
V2 0.2667637 0.0000000

$beta[[9]]
       [,1]      [,2]
V1 0.000000 0.2743195
V2 0.265896 0.0000000

$beta[[10]]
        [,1]      [,2]
V1 0.0000000 0.2916729
V2 0.2652122 0.0000000

$beta[[11]]
        [,1]      [,2]
V1 0.0000000 0.3053482
V2 0.2646734 0.0000000

$beta[[12]]
        [,1]     [,2]
V1 0.0000000 0.316125
V2 0.2642487 0.000000

$beta[[13]]
       [,1]      [,2]
V1 0.000000 0.3246176
V2 0.263914 0.0000000

$beta[[14]]
        [,1]      [,2]
V1 0.0000000 0.3313101
V2 0.2636503 0.0000000

$beta[[15]]
        [,1]      [,2]
V1 0.0000000 0.3365842
V2 0.2634425 0.0000000

$beta[[16]]
        [,1]      [,2]
V1 0.0000000 0.3407403
V2 0.2632788 0.0000000

$beta[[17]]
         [,1]      [,2]
V1 0.01049499 0.3411891
V2 0.26084171 0.0000000

$beta[[18]]
         [,1]      [,2]
V1 0.04746595 0.3336664
V2 0.25284326 0.0000000

$beta[[19]]
        [,1]      [,2]
V1 0.0765912 0.3277314
V2 0.2465616 0.0000000

$beta[[20]]
        [,1]      [,2]
V1 0.0995448 0.3230498
V2 0.2416153 0.0000000

$beta[[21]]
        [,1]      [,2]
V1 0.1176303 0.3193628
V2 0.2377174 0.0000000

$beta[[22]]
        [,1]      [,2]
V1 0.1318905 0.3164551
V2 0.2346456 0.0000000

$beta[[23]]
        [,1]        [,2]
V1 0.1431255 0.314162534
V2 0.2322297 0.000163987

$beta[[24]]
        [,1]        [,2]
V1 0.1526248 0.312012856
V2 0.2306674 0.007805141

$beta[[25]]
        [,1]      [,2]
V1 0.1601061 0.3103150
V2 0.2294485 0.0138349

$beta[[26]]
        [,1]       [,2]
V1 0.1660075 0.30897628
V2 0.2284835 0.01858019

$beta[[27]]
        [,1]       [,2]
V1 0.1706423 0.30792353
V2 0.2277267 0.02232218

$beta[[28]]
        [,1]       [,2]
V1 0.1743016 0.30709316
V2 0.2271304 0.02526964

$beta[[29]]
        [,1]      [,2]
V1 0.1771782 0.3064435
V2 0.2266542 0.0275836

$beta[[30]]
        [,1]       [,2]
V1 0.1794644 0.30592059
V2 0.2262928 0.02942172


$loss
[1] "psvm"

$way
[1] 1

$call
smac(x = ex1.data$ex1.x, y = ex1.data$ex1.y, loss = "p", nlambda = 30)

attr(,"class")
[1] "smac"

smac documentation built on May 1, 2019, 9:11 p.m.

Related to smac in smac...