Skip to main content

Featuretools Transformer for Scikit-Learn Pipeline use.

Project description

featuretools-sklearn-transformer

CircleCI codecov

Featuretools' DFS as a scikit-learn transformer

Install

pip install featuretools_sklearn_transformer

Use

import featuretools as ft
import pandas as pd

from featuretools.wrappers import DFSTransformer
from sklearn.pipeline import Pipeline
from sklearn.ensemble import ExtraTreesClassifier

# Get examle data
n_customers = 3
es = ft.demo.load_mock_customer(return_entityset=True, n_customers=5)
y = [True, False, True]

# Build pipeline
pipeline = Pipeline(steps=[
    ('ft', DFSTransformer(entityset=es,
                            target_entity="customers",
                            max_features=3)),
    ('et', ExtraTreesClassifier(n_estimators=100))
])

# Fit and predict
pipeline.fit([1, 2, 3], y=y) # fit on first 3 customers
pipeline.predict_proba([4,5]) # predict probability of each class on last 2
pipeline.predict([4,5]) # predict on last 2

# Same as above, but using cutoff times
ct = pd.DataFrame()
ct['customer_id'] = [1, 2, 3, 4, 5]
ct['time'] = pd.to_datetime(['2014-1-1 04:00',
                                '2014-1-2 17:20',
                                '2014-1-4 09:53',
                                '2014-1-4 13:48',
                                '2014-1-5 15:32'])

pipeline.fit(ct.head(3), y=y)
pipeline.predict_proba(ct.tail(2))
pipeline.predict(ct.tail(2))

Feature Labs

Featuretools

featuretools-sklearn-transformer is an open source project created by Feature Labs. To see the other open source projects we're working on visit Feature Labs Open Source. If building impactful data science pipelines is important to you or your business, please get in touch.

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

Built Distribution

File details

Details for the file featuretools_sklearn_transformer-0.1.0.tar.gz.

File metadata

  • Download URL: featuretools_sklearn_transformer-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for featuretools_sklearn_transformer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b066aab37121c6b713bc121e17277bfbc7d5c72d0be6a03d8b4795101609bbb
MD5 f48698817d03fa212de347d33982d74b
BLAKE2b-256 f72e9a4f684279d9f5a826e40b70312a796556b69e3ff98c6601d904a2744540

See more details on using hashes here.

File details

Details for the file featuretools_sklearn_transformer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: featuretools_sklearn_transformer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for featuretools_sklearn_transformer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89103eeb9185ffec86174508363bf1c273ecd92671c849372591da1dd888c24b
MD5 37eb44b9d8123df16a157491e3d9a7f3
BLAKE2b-256 45a9a3eecc737964ee847f52f48a5bae78ebe61860c278232066d3afff2a756f

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