Description Usage Arguments Value Author(s) References See Also Examples
This function transforms the a weighted SVM problem into its dual form, and solves it by the quadratic programing applying ipop
in package kernlab
. This is the core step in the improved single stage outcome weighted learning (Liu et.al.2015), and now it can takes positive and negative outcomes as an improvement from Zhao et.al.2012. The function wsvm
can implement weighted SVM with gaussian or linear kernel. O-learning target at maximizing the expected value function by transforming it into a classification problem, mapping the feature variables X to the optimal treatment choice, which is sign(f(x))=sign(h(x)β+β_0).
The original problem weighted SVM problem is min 0.5|β|^2 + C Σξ_i|wR_i|, subject to ξ_i≥ 0 ,sign(wR_i)A_i(X_iβ+β_0≥ 1-ξ_i)
The transformed dual problem is \min_{α} 0.5∑_i∑_j α_i wR_i A_i X_i^T X_j A_j wR_j α_j - ∑_i |wR_i| α_i, subject to 0≤α_i≤ C, and ∑_iα_i wR_i A_i=0.
1 |
X |
a n by p matrix, n is the sample size, p is the number of feature variables. |
A |
a vector of the treatment assignments coded by 1 and -1. |
wR |
a vector of weighted outcomes computed before hand, it is the outcome R_i weighted by inverse randomzation or observational probability. wR_i=R_i/π_i |
kernel |
the kernel function for weighted SVM, can be |
sigma |
the tuning parameter for 'rbf' kernal, this is from |
C |
the tuning parameter for weighted SVM in the primal problem min 0.5|β|^2 + C Σξ_i|wR_i|, subject to ξ_i≥ 0, sign(wR_i)A_i(X_iβ+β_0≥ 1-ξ_i) |
e |
the rounding error when computing the bias, for the varaibles α_i's in the dual problem, if |α_i|<e, we consider α=0. |
If kernel 'linear'
is specified, it returns an object of class 'linearcl'
, and it is a list include the following elements:
alpha1 |
the scaled solution for the dual problem: alpha1_i=α_i A_i wR_i |
bias |
the intercept β_0 in f(X)=β_0+Xβ. |
fit |
a vector of estimated values for \hat{f(x)} in training data, fit=bias+Xβ=bias+X*X'*alpha1. |
beta |
The coefficients β for linear SVM, f(X)=bias+Xβ. |
If kernel 'rbf'
is specified, it returns an object of class 'rbfcl'
, and it is a list include the following elements:
alpha1 |
the scaled solution for the dual problem: alpha1_i=α_i A_i wR_i and Xβ= K(X,X)*alpha1 |
bias |
the intercept β_0 in f(X)=β_0+h(X)β. |
fit |
a vector of estimated values for \hat{f(x)} in training data, fit=β_0+h(X)β=bias+K(X,X)*alpha1. |
Sigma |
the bandwidth parameter for the rbf kernel |
X |
the matrix of training feature variable |
Ying Liu yl2802@cumc.columbia.edu http://www.columbia.edu/~yl2802/
Liu et al. (2015). Under double-blinded review.
Zhao, Y., Zeng, D., Rush, A. J., & Kosorok, M. R. (2012). Estimating individualized treatment rules using outcome weighted learning. Journal of the American Statistical Association, 107(499), 1106-1118.
plot.linearcl
predict.linearcl
predict.rbfcl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #generating random asigned treatment vector A
n=200
A=2*rbinom(n,1,0.5)-1
p=20
mu=numeric(p)
Sigma=diag(p)
#feature variable is multivariate normal distributed
X=mvrnorm(n,mu,Sigma)
#the outcome is generated where the true optimal treatment
#is sign of the interaction term(of treatment and feature)
R=X[,1:3]%*%c(1,1,-2)+X[,3:5]%*%c(1,1,-2)*A+rnorm(n)
# linear SVM
model1=wsvm(X,A,R)
#Check the total number that agress with the true optimal treatment among n=200 patients
sum(sign(model1$fit)==sign(X[,3:5]%*%c(1,1,-2)))
# SVM with rbf kernel and sigma=0.05
model2=wsvm(X,A,R,'rbf',0.05)
#Check the total number that agress with the true optimal treatment among n=200 patients
sum(sign(model2$fit)==sign(X[,3:5]%*%c(1,1,-2)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.