Displaying 20 results from an estimated 3000 matches similar to: "predict.naiveBayes() bug in e1071 package"
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);
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"
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
2008 Jun 25
1
Extract naiveBayes details
Hey,
I just like to know how to extract details from the naiveBayes model
(package e1071). I mean, for each possible value the model defines how much
it influences the outcome. I want to sort those probabilities and show the
values with the highest impact.
How could I do that?
PS: I tried using []'s to get to the model's internals, however, all I get
is a "list" not a
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,
2009 Jan 15
2
LCA (e1071 package): error
Hello,
I will use the lca method in the e1071 package. But I get the following error:
Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) :
number of items to replace is not a multiple of replacement length
Does anybody know this error and knows what this means?
Kind regards,
Tryntsje
2010 Nov 03
2
[klaR package] [NaiveBayes] warning message numerical 0 probability
Hi,
I run R 2.10.1 under ubuntu 10.04 LTS (Lucid Lynx) and klaR version 0.6-4.
I compute a model over a 2 classes dataset (composed of 700 examples).
To that aim, I use the function NaiveBayes provided in the package
klaR.
When I then use the prediction function : predict(my_model, new_data).
I get the following warning :
"In FUN(1:747[[747L]], ...) : Numerical 0 probability with
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
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
2015 Oct 22
2
C_LogLin (stats/loglin)
Hi everyone,
I have a question regarding a C function of the "stats" package in R.
I tried to understand the ?loglin? basic function of the ?stats?
package implemented in
R. The implemented function itself runs without any problem (perhaps
see sample). When I
ran it line by line it stopped at the lines 23-24 of the
loglin-function; (the following line):
z <- .Call(C_LogLin,
2009 Feb 19
1
Bug in predict function for naiveBayes?
Dear all,
I tried a simple naive Bayes classification on an artificial dataset, but I
have troubles getting the predict function to work with the type="class"
specification. With type= "raw", it works perfectly, but with type="class" I
get following error :
Error in as.vector(x, mode) : invalid 'mode' argument
Data : mixture.train is a training set with 100
2007 Apr 08
1
buglet in terms calculations
Hi,
Vince and I have noticed a problem with non-syntactic names in data
frames and some modeling code (but not all modeling code).
The following, while almost surely as documented could be a bit more
helpful:
m = matrix(rnorm(100), nc=10)
colnames(m) = paste(1:10, letters[1:10], sep="_")
d = data.frame(m, check.names=FALSE)
f = formula(`1_a` ~ ., data=d)
tm =
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
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:
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<-
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 <-
2012 Aug 09
2
Analyzing Poor Performance Using naiveBayes()
My data is 50,000 instances of about 200 predictor values, and for all 50,000
examples I have the actual class labels (binary). The data is quite
unbalanced with about 10% or less of the examples having a positive outcome
and the remainder, of course, negative. Nothing suggests the data has any
order, and it doesn't appear to have any, so I've pulled the first 30,000
examples to use as
2014 Jun 12
1
do.call Error for Function Not Present When Manually Called
Hello,
The e1071 function naiveBayes gives an error when called by do.call, although it doesn't give any error if I call it manually.
Browse[1]> trainParams at classifier
function (x, ...)
UseMethod("naiveBayes")
<environment: namespace:e1071>
Browse[1]> trained <- do.call(trainParams at classifier, paramList)
Error in names(dimnames(tables[[i]])) <- c(Yname,
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"),
2018 Feb 26
3
Random Seed Location
Hi all,
For some odd reason when running na?ve bayes, k-NN, etc., I get slightly
different results (e.g., error rates, classification probabilities) from run
to run even though I am using the same random seed.
Nothing else (input-wise) is changing, but my results are somewhat different
from run to run. The only randomness should be in the partitioning, and I
have set the seed before this