search for: truecoef

Displaying 2 results from an estimated 2 matches for "truecoef".

2007 Jan 19
1
naive bayes help
...<- 200 # number of training points n.test <- 200 # number of test points p<-2 # dimension of input space z <- matrix(rnorm((n+n.test)*p),ncol=p) x <- matrix(0,nrow=n+n.test,ncol=p) for (i in 1:p) x[,i] <- z%*%rnorm(p) truecoef <- c(1,2) prob1 <- exp(x%*%truecoef)/(1+exp(x%*%truecoef)) # prob is the true probability of class 1 y <- rbinom(n+n.test,1,prob1) # separate the data into train and test sets mydata <- data.frame(y=y[1:n],x=x[1:n,]) mydata.test <- data.frame(y=y[n+(1:n.test)],x=x[n+(1: n.test),]) ##...
2007 Jan 18
0
help with niave bayes
...<- 200 # number of training points n.test <- 200 # number of test points p<-2 # dimension of input space z <- matrix(rnorm((n+n.test)*p),ncol=p) x <- matrix(0,nrow=n+n.test,ncol=p) for (i in 1:p) x[,i] <- z%*%rnorm(p) truecoef <- c(1,2) prob1 <- exp(x%*%truecoef)/(1+exp(x%*%truecoef)) # prob is the true probability of class 1 y <- rbinom(n+n.test,1,prob1) # separate the data into train and test sets mydata <- data.frame(y=y[1:n],x=x[1:n,]) mydata.test <- data.frame(y=y[n+(1:n.test)],x=x[n+(1:n.test),]) ###...