Learn R Programming

spa (version 2.0)

update.spa: Update procedure for transductive prediction with the SPA

Description

This implements the transductive prediction for an spa object. It performs regularization/region approach for transductive prediction. In addition it can also updates an existing spa object with new transductive estimate.

Usage

"update"(object,ynew,xnew,gnew, type=c("vector","probs","coef","all"), reg=c("ridge","hlasso"),trans.update=FALSE, dat=list(k=0,l=Inf),verbose=FALSE,FUN=sum,...)

Arguments

object
an object of type spa
ynew
an object of type spa
xnew
an object of type spa
gnew
an object of type spa
type
the type of predictions in classification, classes, probabilities or both. In the case of both the object will return an additional penalty vector corresponding to the rate function for each case.
reg
for regression it is automatically taken as a ridge penalty. In the case of classification one can use either ridge or the hyperbolic l1 penalty (hlasso).
trans.update
comming soon
verbose
comming soon
dat
data driven estimation routine consists of list k for the number of vertex sets, and l for the regularization (see reference). default dat=list(k=0,l=Inf)
FUN
measure used to sort WUL, the unlabeled-labeled partition. The FUN=sum multiplies WUL times a vector of ones, others may include max.
...
additional arguments passed into the function

References

M. Culp (2011). spa: A Semi-Supervised R Package for Semi-Parametric Graph-Based Estimation. Journal of Statistical Software, 40(10), 1-29. URL http://www.jstatsoft.org/v40/i10/.

Examples

Run this code
## Use simulated example (two moon)
set.seed(100)
dat=spa.sim(type="moon") 

##Use spa to train with a supervised/transductive kernel smoother
gsemi<-spa(dat$y,graph=as.matrix(daisy(dat[,-1])))

##Use spa to update the object with new data
dat<-rbind(dat,spa.sim(100,0))
gsemi<-update(gsemi,ynew=dat$y,,as.matrix(daisy(dat[,-1])),trans.update=TRUE)

Run the code above in your browser using DataLab