Skip to main content

A Python wrapper for the Weka data mining library.

Project description

Provides a convenient wrapper for calling Weka classifiers from Python.

Installation

Install Weka. On Debian/Ubuntu this is simply:

sudo apt-get install weka

Install the Python package:

sudo pip install -U https://github.com/chrisspen/weka/tarball/master

Usage

Train and test a Weka classifier by instantiating the Classifier class, passing in the name of the classifier you want to use:

from weka.classifiers import Classifier
c = Classifier(name='weka.classifiers.lazy.IBk', ckargs={'-K':1})
c.train('training.arff')
predictions = c.predict('query.arff')

Alternatively, you can instantiate the classifier by calling its name directly:

from weka.classifiers import IBk
c = IBk(K=1)
c.train('training.arff')
predictions = c.predict('query.arff')

The instance contains Weka’s serialized model, so the classifier can be easily pickled and unpickled like any normal Python instance:

c.save('myclassifier.pkl')
c = Classifier.load('myclassifier.pkl')
predictions = c.predict('query.arff')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weka-0.1.2.tar.gz (14.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page