• Tidak ada hasil yang ditemukan

Conclusion

DHGLM 모형 classification을 수행한 결과 kernel의 형태에 따라 분류 경계의 모양이 큰 차이를 나타내는 것을 볼 수 있다. Radial kernel 의 경 우, d의 수준이 작아질수록 Misclassification은 작게 나오지만 Test error 가 크게 나온다. λ의 변화에는 Misclassification의 큰 변화는 없지만 부드 러운 분류경계가 나타남을 알 수 있다. 또한 α가 작을수록 misclassifica- tion과 Test error 모두 작게 나옴을 알 수 있다. 또한 Polynomial kernel 의 경우 d의 수준 변화에 따라 분류 경계의 형태가 크게 변하는 것을 볼 수 있다. 반면 λ와 α의 수준 변화에는 큰 차이를 나타내지 않는다.

SVM은 Hinge loss + Ridge penalty 형태로 나타내어진다. DHGLM 모형은 이것과 두가지 차이점을 지니고 있다. 첫째 Loss가 Binomial이다. 둘째, 각 벡터와 점을 랜덤변수로 본다. 즉 normal 랜덤 효과와 카이제곱 랜덤 효과를 설정한다. 이와같이 작성한 DHGLM 모형을 SVM과 비교하 면 Test Error와Misclassification을 고려해서 정한 분류 경계의형태가 끝 점에서 SVM이 조금 더 좋음을 볼 수 있다. 향후 DHGLM 모형의 Loss에 변화를 주어가며 모형을 찾아나가는 작업을 한다면 분류의 질 향상이 기 대된다.

참고 문헌

Lee, Y., A.Nelder, J. and Pawitan, Y (2006). Generalized linear models with random effects. Chapman and Hall/CRC, 396. Hastie, T., Tibshi- rani, R. and Friedman, J. (2008). The elements of statistical learning.

Springer series in statistics, 24, 625-648.

”Support Vector machine and kernel method”, Pattern informa- tion processing(2002 Autumn Semester)Session 12, 2003.

Steve Gunn, ”Support Vector Machine for Classification and Re- gression”,ISIS Technical report, university of Southampton,1998.

Cortes, C., Vapnik, V. (1995). Support-Vector Networks. Machine Learning, 20, 273-297.

Wahba, G., Lin Y., Zhang H. (2000). Generalized Approximate Cross Validation For Support Vector Machines, Or, Another Way To Look At Margin Like Quantities, submitted for publicaion.

Hastie, T., Tibshirani, R., Rosset, S., Zhu, Ji. (2004). The Entire Regularization Path for the Support Vector Machine . The Journal of Machine Learning Research, 5, 1391-1415.

Abstract in English

The statistical classification is widely used in every area of studies and industries. Support Vector Machine(SVM) is classifier which can be ap- plied to the case of regression and has the advantage of accuracy of predic- tion and data accessibility, especially for a data having binary responses.

This leads onto mapping the input into a higher dimensional feature space by a suitable choice of kernel function.

Hierarchical generalized linear model(HGLM) proposed by Lee and Nelder is a linear model method that sets various distributions to fixed and ran- dom effect. Furthermore, Double HGLMs(DHGLM) introduced by Lee and Nelder is a model in which random effects can be specified in both the mean and the dispersion components. Thus SVM can be treated as HGLM and DHGLM.

This thesis first introduces SVM, HGLM and DHGLM. Second, it sug- gests new classifier using DHGLM. Then it compares new one and exist- ing SVM classifier, includes computing algorithm R script.

Key words : Support vector machine, SVM, Double Hierarchical Gen- eralized linear model, DHGLM, classifier

Serial Number : 2013-20216

부록

# foreign 패키지 필요#

install.packages(“foreign”) library(foreign)

data.restore(“C:/mixture.example.data”,print=T) xy=cbind(data$x,data$y)

green=xy[xy[,3]==0,]

red=xy[xy[,3]==1,]

plot(xy)

points(green,col=“green”) points(red,col=“red”)

str(data)

# Bernoulli model with gaussian random effects # library(foreign)

data.restore(“C:/mixture.example.data”,print=T)

K.value <-function(x1,x2,type, d){ if (type==“poly”){

K.value<-(1+sum(x1*x2))∧d

}

if (type==“radial”){

K.value <- exp(-sum((x1-x2)∧2)/d) }

K.value }

K.mat<-function(X, type, d){ n<-dim(X)[1]; p<-dim(X)[2]

K.matrix<-matrix(0,n,n) for ( i in 1:n){

for ( j in 1: i){ x1<-X[i,]; x2<-X[j,]

K.matrix[i,j]<-K.matrix[j,i]<-K.value(x1,x2,type,d) }

}

K.matrix }

svm.logistic<-function(y,X, lam=1, alpha=3, type=“radial”, d=1){ Kmat<-K.mat(X,type=type, d=d)

b0<-0; v<-rep(0,N); lam<-lam; alpha<-alpha;

econv<-1 econvb0<-1

while ( econv>1e-03){ eta<-b0 + Kmat%*%v P<-exp(eta)/(1+exp(eta))

w.hat<-as.numeric((alpha-1)/(1+t(v)%*%Kmat%*%v/lam)) dhdv<-t(Kmat)%*%(y-P) - w.hat*(Kmat%*%v/lam)

W<-diag(c(P*(1-P)))

hess<-t(Kmat)%*%W%*%Kmat + w.hat*Kmat/lam v.old<-v

v<-v.old + solve(hess+ 0.01*diag(1,N))%*%dhdv

while ( econvb0>1e-03){ if (econv<10){

eta<-b0 + Kmat%*%v P<-exp(eta)/(1+exp(eta))

dWdb0<-diag(c( P*(1-P)*(1-2*P) ))

dhdb0<-sum(y-P)-sum(diag(solve(hess+0.01*diag(1,N))     %*%(t(Kmat)%*%dWdb0%*%Kmat)))

hessb0<-sum(P*(1-P))

b0.old<-b0

b0<-b0.old + dhdb0/hessb0

econvb0<-abs(dhdb0) print(c(“b0”,econvb0)) }

}

econv<-max(abs(dhdv)) print(c(“v”,econv)) }

# y hat #

eta.hat<-b0 + Kmat%*%v

y.hat<-exp(eta.hat)/(1+exp(eta.hat)) return(list(b0=b0, v=v, Kmat=Kmat)) }

# Run #

result=c(0,0,0,0) d.svm=4

lam=100 alpha=5

type.svm<-“radial”

#type.svm<-“poly”

y<-as.numeric(data$y)

N<-length(y) X<-data$x

h.svm<-svm.logistic(y,X, lam=lam, alpha=alpha, type=type.svm, d=d.svm) v<-h.svm$v; b0<-h.svm$b0; Kmat<-h.svm$Kmat;

# y estimate # predH=c(0) for(i in 1:6831){ newx=data$xnew[i,]

eta.pred<-b0 for (k in 1:N){

eta.pred<- eta.pred + K.value(newx, X[k,], type=type.svm, d=d.svm)*v[k]

}

predH[i]<-exp(eta.pred)/(1+exp(eta.pred)) }

test.error<-sum(data$marginal*(data$prob*I(predH<1/2)      +(1-data$prob)*I(predH>=1/2)))

predH=c(0) mis=0

for(i in 1:200){ newx=data$x[i,]

eta.pred<-b0 for (k in 1:N){

eta.pred<- eta.pred + K.value(newx, X[k,], type=type.svm, d=d.svm)*v[k]

}

predH<-exp(eta.pred)/(1+exp(eta.pred)) if(predH<1/2 & data$y[i]==1){mis=mis+1} if(predH>=1/2 & data$y[i]==0){mis=mis+1} }

result=rbind(result,c(d.svm,lam,alpha,test.error,mis)) result

result=result[-1,]

result

Dokumen terkait