Skip to main content

A scikit-learn based AutoML tool

Project description

skplumber

Build Status

A package for automatically sampling, training, and scoring machine learning pipelines on classification or regression problems. The base constructs (pipelines, primitives, etc.) take heavily from the Data Driven Discovery of Models (D3M) core package.

Getting Started

Installation

pip install skplumber

Usage

The SKPlumber AutoML System

The top-level API of the package is the SKPlumber class. You instantiate the class, then use it's fit method to perform a search for an optimal machine learning (ML) pipeline, given your input data X, and y (a pandas.DataFrame and pandas.Series respectively). Here is an example using the classic iris dataset:

from skplumber import SKPlumber
import pandas as pd
from sklearn.datasets import load_iris

dataset = load_iris()
X = pd.DataFrame(data=dataset["data"], columns=dataset["feature_names"])
y = pd.Series(dataset["target"])

# Ask plumber to find the best machine learning pipeline it
# can for the problem in 60 seconds.
plumber = SKPlumber(problem="classification", budget=60)
plumber.fit(X, y)

# To use the best found machine learning pipeline on unseen data:
predictions = plumber.predict(unseen_X)

Pipeline

The Pipeline class is a slightly lower level API for the package that can be used to build, fit, and predict arbitrarily shaped machine learning pipelines. For example, we can create a basic single level stacking pipeline, where the output from predictors are fed into another predictor to ensemble in a learned way:

from skplumber import Pipeline
from skplumber.primitives import transformers, classifiers
import pandas as pd
from sklearn.datasets import load_iris

dataset = load_iris()
X = pd.DataFrame(data=dataset["data"], columns=dataset["feature_names"])
y = pd.Series(dataset["target"])

# A random imputation of missing values step and one hot encoding of
# non-numeric features step are automatically added.
pipeline = Pipeline()
# Preprocess the inputs
pipeline.add_step(transformers["StandardScalerPrimitive"])
# Save the pipeline step index of the preprocessor's outputs
stack_input = pipeline.curr_step_i
# Add three classifiers to the pipeline that all take the
# preprocessor's outputs as inputs
stack_outputs = []
for clf_name in [
    "LinearDiscriminantAnalysisPrimitive",
    "DecisionTreeClassifierPrimitive",
    "KNeighborsClassifierPrimitive"
]:
    pipeline.add_step(classifiers[clf_name], [stack_input])
    stack_outputs.append(pipeline.curr_step_i)
# Add a final classifier that takes the outputs of all the previous
# three classifiers as inputs
pipeline.add_step(classifiers["RandomForestClassifierPrimitive"], stack_outputs)

# Train the pipeline
pipeline.fit(X, y)

# Have fitted pipeline make predictions
pipeline.predict(X)

Package Opinions

  • A pipeline's final step must be the step that produces the pipeline's final output.
  • All missing values are imputed.
  • All columns of type object and category are one hot encoded.

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

skplumber-0.6.2.dev0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

skplumber-0.6.2.dev0-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file skplumber-0.6.2.dev0.tar.gz.

File metadata

  • Download URL: skplumber-0.6.2.dev0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for skplumber-0.6.2.dev0.tar.gz
Algorithm Hash digest
SHA256 f0e123e0132785ec04920be78ae8c77ce98944a4c34efcf5ec1244ee0a177482
MD5 f283d4184af7c905d170b7c141fc0bbf
BLAKE2b-256 efe8b83bb42b13131b571e3d2fea9d36e6ee817dac4fe2b561bb5a64ad54d2b2

See more details on using hashes here.

File details

Details for the file skplumber-0.6.2.dev0-py3-none-any.whl.

File metadata

  • Download URL: skplumber-0.6.2.dev0-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for skplumber-0.6.2.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 774862a7e00622e10855d81c9fe89a2dcd52537f4f3000c11282eac1f0789032
MD5 e9d58d422a5a24f97f3288ff92e1c059
BLAKE2b-256 be0533a5c64bd08e7f04a8eed386e515ceb3eb1128e5b0b8463de95e1a016bd8

See more details on using hashes here.

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