######################################################### ## ## kdd data mining competition: ## try nearest neighbor logistic regression ## ## use Weiliang's functions to get the distance matrix ## ######################################################### source("separation.R") source("matrix_position.R") y<-read.table("http://hajek.stat.ubc.ca/~fyuan/kdd/kdd_blocks_weiliang.dat",header=T) cl<-as.vector(y[,1]) x<-as.matrix(y[,-c(1:3)]) cl.u<-unique(cl) names(cl.u)<-1:k0 tmpcl<-cl k0<-length(cl.u) for(i in 1:k0) { tmpcl[cl==cl.u[i]]<-i } unix.time(tmp<-GetJMatrix(x, tmpcl, th.Jstar=0.1, alpha=0.05)) names(tmp) tmp$Jmat tmp2<-tmp$Jmat diag(tmp2)<-1 min.row.col(tmp2)