Skip to main content

A Python wrapper for MADlib ( - an open source library for scalable in-database machine learning algorithms

Project description

Python wrapper for MADlib
Srivatsan Ramanujam <>, 3 Jan 2013
This currently implements Linear regression, Logistic Regression,
SVM (regression & classification), K-Means and LDA algorithms of MADlib.
Refer : for MADlib's user documentation.

Dependencies :
You'll need the python extension : psycopg2 to use PyMADlib.
(i) If you have matplotlib installed, you'll see Matplotlib visualizations for Linear Regression demo.
(ii) If you have installed networkx (, you'll see a visualization of the k-means demo
(iii) PyROC ( is included in the source of this distribution with permission from its developer. You'll see a visualization of the ROC curves for Logistic Regression.

To configure your DB Connection parameters
You should create a file in your home directory : ~/.pymadlib.config
that should look like so :

user = gpadmin
password = XXXXX
hostname = (or the IP of your DB server)
port = 5432 (the port# of your DB)
database = vatsandb (the database you wish to connect to)

1) You may install pymadlib by downloading the source (from PyPI) and then run the following :

sudo python build
sudo python install
2) If you use easy_install or pip, simply run :
sudo easy_install pymadlib

Running the Demos :
You may run the demo from the extracted directory of pymadlib like so :



If you installed PyMADlib using instructions in the previous section, then simply run

python -c 'from pymadlib.example import runDemos; runDemos()'

Datasets packaged with this installation :
PyMADlib packages publicly available datasets from the UCI machine learning repository and other sources.

1) Wine quality dataset from UCI Machine Learning repository :
2) Auto MPG dataset from UCI ML repository :
3) Obama-Romney second presidential debate (2012) transcripts for the LDA models.

Installation Issues:

Installing pymadlib using distutils should automatically install the dependent library psycopg2, which is required to
connect to a PostGres database (where MADlib is installed on). If you are using Mac OSX 10.6.X you may run into issues
with installing psycopg2.

Here are some blogs which discuss the issue and offer solutions:

Project details

Release history Release notifications

History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pymadlib-0.1.6.tar.gz (54.8 kB) Copy SHA256 hash SHA256 Source None May 17, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page