# \donttest{
set.seed(1027)
#simulataed univariate data
data = genModelFD(ncurves=300, nsplines=35, alpha=c(0.9,0.9,0.9),
eta=c(10, 7, 17))
plot(data$fd, col = data$groupd)
clm = data$groupd
model1=c("AkjBkQkDk", "AkjBQkDk", "AkBkQkDk", "ABkQkDk", "AkBQkDk", "ABQkDk")
t1<-tfunHDDC(data$fd,K=3,threshold=0.2,init="kmeans",nb.rep=1,dfconstr="no",
dfupdate="numeric", model=model1[1], itermax=10)
if (!is.null(t1$class)) table(clm, t1$class)
###############example when some classifications are known
known1=rep(NA,1,300)
known1[1]=clm[1]
known1[103]=clm[103]
known1[250]=clm[250]
t2<-tfunHDDC(data$fd,K=3,threshold=0.2,init="kmeans",nb.rep=1,dfconstr="no",
dfupdate="numeric", model=model1[1],known=known1, itermax=10)
if (!is.null(t2$class)) table(clm, t2$class)
####### example when some classifications are known
known1=rep(NA,1,300)
known1[1:100]=rep(3,1,50)
t3<-tfunHDDC(data$fd,K=3,threshold=0.2,init="kmeans",nb.rep=1,dfconstr="no",
dfupdate="numeric", model=model1[1],known=known1, itermax=10)
if (!is.null(t3$class)) table(clm, t3$class)
############################multivariate simulated data
set.seed(1027)
conTrig <- genTriangles()
cls = conTrig$groupd # groups 5 and 6 (contaminated) into 1 and 3 respectively
res_s = tfunHDDC(conTrig$fd, K=4, dfconstr="no", dfupdate="numeric",
model="ABKQKDK", init="kmeans", threshold=0.2, nb.rep=1,
itermax=10)
if (!is.null(res_s$class)) table(cls, res_s$class)
# }
Run the code above in your browser using DataLab