similar to: Naive Bayes Issue - Can't Predict - Error is "Error in log(sapply(attribs...)

Displaying 20 results from an estimated 1000 matches similar to: "Naive Bayes Issue - Can't Predict - Error is "Error in log(sapply(attribs...)"

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 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<-
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
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,
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"),
2007 Jan 19
1
naive bayes help
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 <-
2007 Aug 22
1
"subscript out of bounds" Error in predict.naivebayes
I'm trying to fit a naive Bayes model and predict on a new data set using the functions naivebayes and predict (package = e1071). R version 2.5.1 on a Linux machine My data set looks like this. "class" is the response and k1 - k3 are the independent variables. All of them are factors. The response has 52 levels and k1 - k3 have 2-6 levels. I have about 9,300 independent variables
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
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:
2012 Nov 08
0
FW: Interfacing R and Weka
-----Original Message----- From: Patrick Connolly Sent: Friday, 9 November 2012 11:29 a.m. To: Peter Alspach Subject: Interfacing R and Weka > version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 15.2 year 2012 month 10 day 26 svn rev
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
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
2012 May 05
1
what is Non-numeric argument to mathematical function in prediction ?
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 <-
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);
2012 Feb 09
1
Tr: Re: how to pass weka classifier options with a meta classifier in RWeka?
Le jeudi 09 f?vrier 2012 ? 15:31 +0200, Kari Ruohonen a ?crit : > Hi, > I am trying to replicate a training of AttributeSelectedClassifier with > CFsSubsetEval, BestFirst and NaiveBayes that I have initially done with > Weka. Now, I am trying to use RWeka in R. > > I have a problem of passing arguments to the CfsSubsetEval, BestFirst > and NaiveBayes. I have first created an
2012 Feb 07
2
predict.naiveBayes() bug in e1071 package
Hi, I'm currently using the R package e1071 to train naive bayes classifiers and came across a bug: When the posterior probabilities of all classes are small, the result from the predict.naiveBayes function become NaNs. This is an issue with the treatment of the log-transformed probabilities inside the predict.naiveBayes function. Here is an example to demonstrate the problem (you might need
2009 Jun 30
2
NaiveBayes fails with one input variable (caret and klarR packages)
Hello, We have a system which creates thousands of regression/classification models and in cases where we have only one input variable NaiveBayes throws an error. Maybe I am mistaken and I shouldn't expect to have a model with only one input variable. We use R version 2.6.0 (2007-10-03). We use caret (v4.1.19), but have tested similar code with klaR (v.0.5.8), because caret relies on
2007 Nov 01
1
RWeka and naiveBayes
Hi I'm trying to use RWeka to use a NaiveBayes Classifier(the Weka version). However it crashes whenever there is a NA in the class Gender Here is the.code I have with d2 as the data frame. The first call to NB doesn't make R crash but the second call does. NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayesSimple") d2[,64]<-d2$Gender=="M"
2012 Feb 10
2
naiveBayes: slow predict, weird results
I did this: nb <- naiveBayes(users, platform) pl <- predict(nb,users) nrow(users) ==> 314781 ncol(users) ==> 109 1. naiveBayes() was quite fast (~20 seconds), while predict() was slow (tens of minutes). why? 2. the predict results were completely off the mark (quite the opposite of the expected overfitting). suffice it to show the tables: pl: android blackberry ipad
2010 Jun 30
1
help on naivebayes function 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);