Questions tagged [naivebayes]

Naive Bayes is a popular (baseline) method for text-classification.

1035 questions
3
votes
0 answers

Multinomial Naive Bayes Classifier sliding window (MOA implementation, weka)

I am facing the following problem: I am trying to implement a MNB classifier in a sliding window. I implemented a LinkedList of the size of the window and store all instances of the stream which have to be considered in it. When a new instance…
3
votes
0 answers

How NaiveBayesClassifier of TextBlob works?

I'm using NaiveBayesClassifier function of TextBlob to classify some phrases and it works fine at the moment. My problem is, I need explain how the function works with table test. How NaiveBayesClassifier of TextBlob works to classify one phrase and…
3
votes
0 answers

Naive Bayes Classification with R

I have been wrangling with R to classify tweets using a Naive Bayes classifier model. Data: Training set with 2 columns: Tweet and Class. There are 300 tweets: 150 classified as "App" and 150 classified as "Other". Objective: Test set with 20 data…
salemmarafi
  • 230
  • 3
  • 12
3
votes
1 answer

naive classifier matlab

When testing the naive classifier in matlab I get different results even though I trained and tested on the same sample data, I was wondering if my code is correct and if someone could help explain why this is? %% dimensionality reduction columns…
G Gr
  • 6,030
  • 20
  • 91
  • 184
2
votes
1 answer

Weighted Naive Bayes Classifier in Apache Mahout

I am using Naive Bayes classifier for my sentiment analysis on customer support. But unfortunately I don't have huge annotated data sets in the customer support domain. But I have a little amount of annotated data in the same domain(around 100…
Greenhorn
  • 1,811
  • 5
  • 21
  • 39
2
votes
1 answer

Multinomial Naive Bayes can't use validation dataset because of ValueError but can use sklearn train_test_split

I am trying to make a MNB classifier for sentiment analysis. I had a dataset that consists of text and label in the following structure where labels are from 1-5. Using huggingface emotions dataset. feature label "I…
dense8
  • 538
  • 1
  • 3
  • 10
2
votes
1 answer

How to get predictions for new data from MultinomialNB?

I'm venturing into a new topic and experimenting with categorising product names. Without deeper knowledge, the use of MultinomialNB (superficially) already yielded quite good results for my use case. import pandas as pd import numpy as np from…
HedgeHog
  • 22,146
  • 4
  • 14
  • 36
2
votes
0 answers

Multinomial naive bayes classifier returns different results on same data

I've been using MultinomialNB classifier from sklearn.naive_bayes library on vectorized text data. make_pipeline( TfidfVectorizer(), MultinomialNB( alpha=0.1, fit_prior=True, …
2
votes
2 answers

Why did i get this "module 'nltk.translate.metrics' has no attribute 'precision'"?

import codes, i've tried importing precision and all the library i still can't get it work import nltk import string import pandas as pd import nltk.metrics import collections from nltk import precision from nltk.metrics.scores import (accuracy,…
Lorale
  • 113
  • 6
2
votes
1 answer

sklearn naive bayes MultinomialNB: Why do I get only one array with coefficients although I have 2 classes?

I have trained a naive bayes MultinomialNB model to predict if an SMS is spam or not. I get 2 classes as expected: nb = MultinomialNB(alpha=0.0) nb.fit(X_train, y_train) print(nb.classes_) #Output: ['ham' 'spam'] but when I output the coefficients…
DaveVentura
  • 612
  • 5
  • 19
2
votes
2 answers

Naive Bayes in Ruby

We are trying to do naive bayes classification in Ruby. Currently we are using http://ai4r.rubyforge.org/ We couldn't get it working for float values and have about 20% points lower accuracy with string values. With float/integers we get a [] no…
2
votes
1 answer

Copy paste a Naive Bayes example code on vscode but got errors

I copied the code from datacamp to try the Naive Bayes classification on my own on python 3.8 . but when run the code the compiler gives this error Traceback (most recent call last): File "c:\Users\USER\Desktop\DATA MINING\NaiveTest.py", line 34,…
Dummy
  • 23
  • 3
2
votes
2 answers

MultinomialNB or GaussianNB or CategoricalNB what to use here?

Let I have a input feature X = {X1, X2}. Where X1 is real-valued (also consider it follows Gaussian Dist) but X2 is a categorical feature. Now if I want to use the Naive Bayes algorithm. Which one I should use? Another way Does GaussianNB works…
2
votes
1 answer

What's the minimum number of features you need to get good results with a Naive Bayes model?

I keep on reading that Naive Bayes needs fewer features than many other ML algorithms. But what's the minimum number of features you actually need to get good results (90% accuracy) with a Naive Bayes model? I know there is no objective answer to…
E. Turok
  • 106
  • 1
  • 7
2
votes
1 answer

I am attempting to use Python MultinomialNB from sklearn to classify some data but it returns a Value Error

I am attempting to use MultinomialNB from sklearn to classify some data. I have made a sample csv with some labelled training data, which I want to use to train the model but I receive the following error message: ValueError: Expected 2D array, got…