search for: naivebay

Displaying 20 results from an estimated 45 matches for "naivebay".

Did you mean: naivebayes
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 to increase 'nvar' depending on your machine): -------------------- 8< -----------------...
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 NaiveBayes implementation from klaR. I get differen...
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&quot...
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 observation 458" As I did not find any documentation or any discussion concerning this warning...
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). suf...
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 interface for the classifier > with: > > AS<-make_Weka_classifier("weka/cl...
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 b...
2010 Jun 30
1
help on naivebayes function in R
...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); pred<-predict(model,test,type = "raw"); table(pred,cl); everything is working fine I am able to build the model and predict also but I am not able to get the confusion matrix using table function.its giving me the following error when I execute the line "table(pred...
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...
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...
2007 Sep 25
1
10- fold cross validation for naive bayes(e1071)
...lready 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, performances=T) model <- naiveBayes(code~., mydata, tune.control) pred <- predict(model, mydata) table(pred, mydata$code) chisq.test(code, pred) but I get the same results as without tuning it. It would be great if someone could help me with this. thx a lot, Juila -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der k...
2011 Feb 08
1
Naive Bayes Issue - Can't Predict - Error is "Error in log(sapply(attribs...)
...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: http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/e1071/html/predict.naiveBayes.html * install.packages('e1071') install.packages('mlbench') library(e1071) library(mlbench) data(HouseVotes84) model <- naiveBayes(Class ~ ., data = HouseVotes84) predict(model, HouseVotes84[1:10,-1]) *My Code That Errors:* resp<-c(0,0,0,0,0,0,0,0,0,1,1,1,1,1,1) var &lt...
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, whe...
2009 Feb 19
1
Bug in predict function for naiveBayes?
...rain <- as.data.frame(rbind(mixture.train,cbind(mvrnorm(n=50, c(2, 0), Sigma),rep(1,50)))) names(mixture.train) <-c("X1","X2","Class") X1 <- rep(seq(-15,15,by=1),31) X2 <- rep(seq(-15,15,by=1),each = 31) mixture.test <- data.frame(X1,X2) Bayes.res <- naiveBayes(Class ~ X1 + X2, data=mixture.train) pred.bayes <-predict(Bayes.res, cbind(mixture.test$X1, mixture.test$X2),type="class") Tried it also with pred.bayes <-predict(Bayes.res, mixture.test,type="class"), but that gives the same effect. Is this a bug or am I missing someth...
2012 Aug 09
2
Analyzing Poor Performance Using naiveBayes()
...bles having identical values for all instances. I have not done anything to check further for dependant variables, and don't know how to. Besides getting a clue, what might be my next best step? -- View this message in context: http://r.789695.n4.nabble.com/Analyzing-Poor-Performance-Using-naiveBayes-tp4639825.html Sent from the R help mailing list archive at Nabble.com.
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, pa...
2007 Jan 19
1
naive bayes help
...%*%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),]) ########################## library(e1071) mydt.nb<-naiveBayes(y~ ., data=mydata) m.pr<-predict(mydt.nb, mydata[,-1], type="class") regards, Leah [[alternative HTML version deleted]]
2010 Aug 30
2
Regarding naive baysian classifier in R
...omb/Part1/Dataset1/groups/train/D1TRg10.txt",header=T); test<-read.table("C:/Users/Aadhithya/Desktop/ThesisDatasetsComb/Part1/Dataset1/groups/test/D1TEg10.txt",header=T); length(test); cl <- c(c(rep("ALL",10), rep("AML",10))); cl <- factor(cl) model <- naiveBayes(t(train),cl); pred<-predict(model, t(test),decision.values=TRUE,probability=TRUE) attr(pred,"probabilities"); table(pred,t(cl)); -- View this message in context: http://r.789695.n4.nabble.com/Regarding-naive-baysian-classifier-in-R-tp2400727p2400727.html Sent from the R help mailin...
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"), sampling.aggregate = mean, cross = 10, best.model = TRUE, performances = TRUE) pred <- predict(model, mydata[,-12], type="class") tune(naiveBayes,...
2018 Feb 26
3
Random Seed Location
...[, 2], n = 20) D. Partition the original (in-sample) data into 60% training and 40% validation sets. > n <- nrow(InvestTech) > train <- sample(1:n, size = 0.6 * n, replace = FALSE) > InvestTechTrain <- InvestTech[train, ] > InvestTechVal <- InvestTech[-train, ] E. Use the naiveBayes function in the e1071 package to fit the model. > model <- naiveBayes(`Purchase (1=yes, 0=no)` ~ ., data = InvestTechTrain) > prob <- predict(model, newdata = InvestTechVal, type = ?raw?) > pred <- ifelse(prob[, 2] >= 0.3, 1, 0) F. Use the confusionMatrix function in the ca...