Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any Naive Bayesian Classifier in python? [closed]

Tags:

  • I have tried the Orange Framework for Naive Bayesian classification.

    • The methods are extremely unintuitive, and the documentation is extremely unorganized. Does anyone here have another framework to recommend?
    • I use mostly NaiveBayesian for now.
  • I was thinking of using nltk's NaiveClassification but then they don't think they can handle continuous variables.

What are my options?

like image 595
disappearedng Avatar asked Apr 05 '10 18:04

disappearedng


People also ask

What are the 3 different Naive Bayes classifier?

There are three types of Naive Bayes model under the scikit-learn library: Gaussian: It is used in classification and it assumes that features follow a normal distribution. Multinomial: It is used for discrete counts. For example, let's say, we have a text classification problem.

What is the main limitation of the naive Bayesian classification algorithm?

Naive Bayes assumes that all predictors (or features) are independent, rarely happening in real life. This limits the applicability of this algorithm in real-world use cases.

How do I fit a Naive Bayes classifier in Python?

First Approach (In case of a single feature) Step 1: Calculate the prior probability for given class labels. Step 2: Find Likelihood probability with each attribute for each class. Step 3: Put these value in Bayes Formula and calculate posterior probability.

What is Naive Bayes classifier Python?

Naive Bayes. Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes' theorem with the “naive” assumption of conditional independence between every pair of features given the value of the class variable.


2 Answers

The scikit-learn has an implementation of Gaussian naive Bayesian classifier. In general, the goal of this library is to provide a good trade off between code that is easy to read and use, and efficiency. Hopefully it should be a good library to learn of the algorithms work.

like image 191
Gael Varoquaux Avatar answered Sep 28 '22 09:09

Gael Varoquaux


This might be a good place to start. It's the full source code (the text parser, the data storage, and the classifier) for a python implementation of of a naive Bayesian classifier. Although it's complete, it's still small enough to digest in one session. I think the code is reasonably well written and well commented. This is part of the source code files for the book Programming Collective Intelligence.

To get the source, click the link, dl and unpack the zip, from the main folder 'PCI_Code', go to the folder 'chapter 6', which has a python source file 'docclass.py. That's the complete source code for a Bayesian spam filter. The training data (emails) are persisted in an sqlite database which is also included in the same folder ('test.db') The only external library you need are the python bindings to sqlite (pysqlite); you also need sqlite itself if you don't already have it installed).

like image 21
doug Avatar answered Sep 28 '22 09:09

doug