similar to: naive bayes help

Displaying 20 results from an estimated 800 matches similar to: "naive bayes help"

2007 Jan 18
0
help with niave bayes
Hello I have a rather simple code and for some reason it produces an error message. If someone can tell me why and how to fix it, I would be very greatful. Thank you in advance. ##### create data set.seed(10) n <- 200 # number of training points n.test <- 200 # number of test points p<-2 # dimension of input space z <-
2012 May 04
1
weird predict function error when I use naive bayes
Hi, I tried to use naivebayes in package 'e1071'. when I use following parameter, only one predictor, there is an error. > m<- naiveBayes(iris[,1], iris[,5]) > table(predict(m, iris[,1]), iris[,5]) Error in log(sapply(attribs, function(v) { : Non-numeric argument to mathematical function However, when I use two predictors, there is not error any more. > m<-
2007 Sep 25
1
10- fold cross validation for naive bayes(e1071)
Hallo! I would need a code for 10-fold cross validation for the classifiers Naive Bayes and svm (e1071) package. Has there already been done something like that? I tried to do it myself by applying the tune function first: library(e1071) tune.control <- tune.control(random =F, nrepeat=1, repeat.aggregate=min.,sampling=c("cross"),sampling.aggregate=mean, cross=10, best.model=T,
2011 Feb 08
1
Naive Bayes Issue - Can't Predict - Error is "Error in log(sapply(attribs...)
Hey guys, I can't get my Naive Bayes model to predict. Forgive me if its simple... I've tried about everything and can't get it to work. Reproduceable code below. Thank you, Mike -- Michael Schumacher Manager Data & Analytics - ValueClick mike.schumacher@gmail.com * Functional Example Code from UCLA:
2009 May 06
1
How to do Naive Bayes in R?
I am wondering if anybody here have a simple example in R for Naive Bayes. For example, I can do k-means clustering on the "iris" data - data(iris) cl <- kmeans(iris[,1:4], 3) cl$cluster cbind(1:150,iris$Species) =========== But how to do Naive Bayes classification in the same "iris" data? Many thanks! -- View this message in context:
2007 Oct 30
1
NAIVE BAYES with 10-fold cross validation
hi there!! i am trying to implement the code of the e1071 package for naive bayes, but it doens't really work, any ideas?? i am very glad about any help!! i need a naive bayes with 10-fold cross validation: code: library(e1071) model <- naiveBayes(code ~ ., mydata) tune.control <- tune.control(random = FALSE, nrepeat = 1, repeat.aggregate = min, sampling = c("cross"),
2012 Jul 05
1
Different level set when predicting with e1071's Naive Bayes classifier
Hi! I'm using the Naive Bayes classifier provided by the e1071 package ( http://cran.r-project.org/web/packages/e1071) and I've noticed that the predict function has a different behavior when the level set of the columns used for prediction is different from the ones used for fitting. From inspecting the predict.naiveBayes I came to the conclusion that this is due to the conversion of
2012 Aug 02
1
Naive Bayes in R
I'm developing a naive bayes in R. I have the following data and am trying to predict on returned (class). dat = data.frame(home=c(0,1,1,0,0), gender=c("M","M","F","M","F"), returned=c(0,0,1,1,0)) str(dat) dat$home <- as.factor(dat$home) dat$returned <- as.factor(dat$returned) library(e1071) m <- naiveBayes(returned ~ ., dat) m
2010 Sep 06
1
calculating area between plot lines
Hi everyone. I have these data: probClass<-seq(0,0.9,0.1) prob1<-c(0.0070,0.0911,0.1973,0.2949,0.3936,0.5030,0.5985,0.6869,0.7820,0.8822) prob2<-c(0.0066,0.0791,0.2358,0.3478,0.3714,0.3860,0.6667,0.6400,0.7000,1.0000) # which I'm plotting as follows: plot(probClass,prob1,xlim=c(0,1),ylim=c(0,1),xaxs='i',yaxs='i',type="n") lines(probClass,prob1)
2011 Oct 06
1
sum of functions
Dear all, I would like to create a code for semiparametric Klein and Spady's estimator. For that I created a function that provides the log-likelihood function for each observation (so it is a function of betas and i, where i denotes the observation). Now, in order to maximize the log-likelihood function, I have to sum these log-likelihood functions for each i and so to get another function
2010 Mar 06
1
Plotting Comparisons with Missing Data
Hi, I'm new to R and I've run into a problem that I'm not really sure how to express properly in the language. I've got a data table that I've read from a file containing some simple information about the performance of 4 algorithms. The columns are the name of the algorithm, the problem instance and the resulting score on that problem (if it wasn't solved I mark that
2008 Apr 22
2
Multidimensional contingency tables
How does one ideally handle and display multidimenstional contingency tables in R v. 2.6.2? E.g.: > prob1<- data.frame(victim=c(rep('white',4),rep('black',4)), + perp=c(rep('white',2),rep('black',2),rep('white',2),rep('black',2)), + death=rep(c('yes','no'),4), count=c(19,132,11,52,0,9,6,97)) > prob1 victim perp
2011 Nov 29
2
aggregate syntax for grouped column means
I am calculating the mean of each column grouped by the variable 'id'. I do this using aggregate, data.table, and plyr. My aggregate results do not match the other two, and I am trying to figure out what is incorrect with my syntax. Any suggestions? Thanks. Here is the data. myData <- structure(list(var1 = c(31.59, 32.21, 31.78, 31.34, 31.61, 31.61, 30.59, 30.84, 30.98, 30.79, 30.79,
2020 Oct 18
1
Resultado de la consola como un tibble
Hola, Bueno, puedes hacer el cálculo de una forma mucho más compacta y rápida. Esta forma es especialmente recomendable cuando tienes muchas columnas y muchas filas. > library(data.table) > myDT <- as.data.table(mtcars) > myDTlong <- melt(myDT, measure.vars=1:ncol(myDT)) > myDTlong[ , list(p_value = shapiro.test(value)$p.value, v_stat = shapiro.test(value)$statistic) , by
2011 Aug 31
1
formatting a 6 million row data set; creating a censoring variable
List, Consider the following data. gender mygroup id 1 F A 1 2 F B 2 3 F B 2 4 F B 2 5 F C 2 6 F C 2 7 F C 2 8 F D 2 9 F D 2 10 F D 2 11 F D 2 12 F D 2 13 F D 2 14 M A 3 15 M A 3 16 M A 3 17
2000 Apr 05
2
My first R-program
Sorry, I pasted the wrong file in earlier... this is the correct one: pValCalculator(b, n=20, m=20) { ind <- 1:min(c(n,m)) prob <- (1-pnorm(b,sd=std*sqrt(ind))) prob1 <- sum((n-ind+1)*(m-ind+1)*prob) prob1 } inputData <- scan("/users/lvssso/projects/LAMA/output/pValLamaScore.tmp", list(block1 = "",block2 = "",width1 = 0,width2 = 0,alignment = 0,score
2010 Aug 30
2
Regarding naive baysian classifier in R
Hi, I have a small doubt regarding naive Bayes. I am able to classify the data's properly but i am just stuck up with how to get the probability values for naive bayes. In the case of SVM we have "attr" function that helps in displaying the probability values. Is there any function similar to "attr" in naive Bayes that can be used for displaying the attribute values. my
2011 Feb 25
0
e1071's Naive Bayes with Weighted Data
Hello fellow R programmers, I'm trying to use package e1071's naiveBayes function to create a model with weighted data. See example below, variable "d" is a count variable that provides the # of records for the given observation combination. Is anyone aware of a "weight" argument to this method? I've been unsuccessful in my research. Thanks, Mike
2006 Jul 24
2
RandomForest vs. bayes & svm classification performance
Hi This is a question regarding classification performance using different methods. So far I've tried NaiveBayes (klaR package), svm (e1071) package and randomForest (randomForest). What has puzzled me is that randomForest seems to perform far better (32% classification error) than svm and NaiveBayes, which have similar classification errors (45%, 48% respectively). A similar difference in
2010 Jun 30
1
how to tabulate the prediction value using table function for naive baiyes in R
Hi, I have written a code in R for classifying microarray data using naive bayes, the code is given below: library(e1071) train<-read.table("Z:/Documents/train.txt",header=T); test<-read.table("Z:/Documents/test.txt",header=T); cl <- c(c(rep("ALL",10), rep("AML",10))); cl <- factor(cl) model <- naiveBayes(train,cl);