Learn R Programming

DTRlearn (version 1.0)

predict.rbfcl: Predict

Description

predict the best treatment for model with class 'linearcl' produced by wsvm with rbf kernel

Usage

## S3 method for class 'rbfcl'
## S3 method for class 'rbfcl':
predict(object, x,...)

Arguments

object
model of class 'rbfcl'
x
a matrix of feature varaibles, n by p
...
further arguments passed to or from other methods.

Value

  • a vector of optimal treatment for each row of x

See Also

wsvm, Olearning_Single

Examples

Run this code
n_cluster=5
pinfo=10
pnoise=10
n=50
m=20
example1=make_classification(n_cluster,pinfo,pnoise,n)
test=make_classification(n_cluster,pinfo,pnoise,m,example1$centroids)
model1=Olearning_Single(example1$X,example1$A,example1$R)
Atp=predict(model1,test$X)
V1=mean(test$R[Atp==test$A])

model2=wsvm(example1$X,example1$A,example1$R,'rbf',0.05)
model2=Olearning_Single(example1$X,example1$A,example1$R,kernel='rbf',m=3)
Atp=predict(model2,test$X)

Run the code above in your browser using DataLab