Displaying 1 result from an estimated 1 matches for "wine_train".
Did you mean:
wine_trace
2009 Mar 04
0
Error in -class : invalid argument to unary operator
...ror that I have been trying to fix for a week or so now.I am trying to
build a classifer that will classify the wine dataset using Naive Bayes.
My code is as follows
library (e1071)
wine<- read.csv("C:\\Rproject\\Wine\\wine.csv")
split<-sample(nrow(wine), floor(nrow(wine) * 0.5))
wine_training <- wine[split, ]
wine_testing <- iris[-split, ]
naive_bayes <-naiveBayes(class~.,data=wine_training)
x_testing <- subset(wine_testing, select = -class)
y_testing <- wine_testing$class # just grab Species variable of
iris_training
pred <- predict(naive_bayes, x_testing)...