plot.linearcl: Plot coefficients for SVM with linear kernel

Description Usage Arguments Author(s) See Also Examples

View source: R/plot.R

Description

The function visualize the contribution of each feature variable by plotting a selected subset of standardized coefficients from SVM with linear kernel, the coefficients are standardized dividing by the L2 norm of the subvector.

Usage

1
2
3
## S3 method for class 'linearcl'
plot(x, index = NULL, names = NULL,
ylab = "std coefficients", xlab = "", col = "gray",...)

Arguments

x

a model with class 'linearcl'.

index

is the vector of indices of variables to plot.

names

is the vector of names of each variables to appear in the plot. If not specified, the names would be V1-Vp.

ylab

The label for the y axis. Defalt is "std coefficients".

xlab

The label for the x axis.

col

color to fill the bars in the plot.

...

further arguments passed to or from other methods.

Author(s)

Ying Liu yl2802@cumc.columbia.edu http://www.columbia.edu/~yl2802/

See Also

Olearning_Single; wsvm

Examples

1
2
3
4
5
6
7
8
9
n=200
A=2*rbinom(n,1,0.5)-1
p=20
mu=numeric(p)
Sigma=diag(p)
X=mvrnorm(n,mu,Sigma)
R=X[,1:3]%*%c(1,1,-2)+X[,3:5]%*%c(1,1,-2)*A+rnorm(n)
model1=Olearning_Single(X,A,R)
plot(model1)

Example output

Loading required package: kernlab
Loading required package: MASS
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-12

Loading required package: ggplot2

Attaching package: 'ggplot2'

The following object is masked from 'package:kernlab':

    alpha

DTRlearn documentation built on April 6, 2018, 1:04 a.m.