English 中文(简体)
Any Naive Bayesian Classifier in python? [closed]
原标题:

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

  • 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?

问题回答

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.

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).

If you re processing natural language, check out the Natural Language Toolkit.

If you re looking for something else, here s a simple search on PyPI.

pebl appears to handle continuous variables.

I found Divmod Reverend to be the simplest and easiest to use Python Bayesian classifier.

I just took Paul Graham s LISP stuff and converted to to Python http://www.paulgraham.com/spam.html

There’s also SpamBayes, which I think can be used as a general naive Bayesian clasisfier, instead of just for spam.





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签