# NOT RUN {
#######
## Equivalent uses of the formula and default s4pm call.
#######
## Set up Sonar data with 20% labeled
library(mlbench)
data(Sonar)
n=dim(Sonar)[1]
p=dim(Sonar)[2]
nu=0.2
set.seed(100)
L=sort(sample(1:n,ceiling(nu*n)))
U=setdiff(1:n,L)
y.true<-Sonar$Class
Sonar$Class[U]=NA
control=SemiSupervised.control(stability=0.0) ## turn off adjustment parameters for comparison
(g.s4pm<-s4pm(Class~.,data=Sonar,control=control)) ### Fit s4pm to Sonar
##The following give equivalent output to the g.s4pm<-s4pm(Class~.,data=Sonar) call.
# }
# NOT RUN {
D11=as.matrix(cosineDist(x.scaleL(Sonar[,-p],L)))
(g.s4pm1<-s4pm(Class~.+dG(D11),data=Sonar,control=control))
#######
## Equivalent uses of the formula, Class ~ ., and default jtharm call.
#######
control=SemiSupervised.control(stability=0.0)
(g.jtharm1<-jtharm(Class~.,data=Sonar,control=control))
(g.jtharm2<-jtharm(Class~dG(D11),data=Sonar,control=control))
# }
Run the code above in your browser using DataLab