Skip to main content

Stacked generalization framework

Project description

CircleCI Documentation status PyPI version

Wolpert, a stacked generalization framework

Wolpert is a scikit-learn compatible framework for easily building stacked ensembles. It supports:

  • Different stacking strategies

  • Multi-layer models

  • Different weights for each transformer

  • Easy to make it distributed

Quickstart

Install

The easiest way to install is using pip. Just run pip install wolpert and you’re ready to go.

Building a simple model

First we need the layers of our model. The simplest way is using the helper function make_stack_layer:

from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from wolpert import make_stack_layer, StackingPipeline

layer0 = make_stack_layer(SVC(), KNeighborsClassifier(),
                          RandomForestClassifier(),
                          blending_wrapper='holdout')

clf = StackingPipeline([('l0', layer0),
                        ('l1', LogisticRegression())])

And that’s it! And StackingPipeline inherits a scikit learn class: the Pipeline, so it works just the same:

clf.fit(Xtrain, ytrain)
ypreds = clf.predict_proba(Xtest)

This is just the basic example, but there are several ways of building a stacked ensemble with this framework. Make sure to check the User Guide to know more.

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

wolpert-0.1.1.tar.gz (20.6 kB view hashes)

Uploaded Source

Built Distribution

wolpert-0.1.1-py2-none-any.whl (28.1 kB view hashes)

Uploaded Python 2

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