Featuretools Transformer for Scikit-Learn Pipeline use.
Project description
featuretools-sklearn-transformer
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=2)),
('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-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.1.tar.gz
.
File metadata
- Download URL: featuretools_sklearn_transformer-0.1.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f381a7f2ee85c4f26a9e39605cfc2d8f830241229e454ce419f314dd6065104 |
|
MD5 | e8ba41f3baf455983321cd67f940ec61 |
|
BLAKE2b-256 | 004e5e66105f7ad7a9e7e91c8c67c025715ef9b22aeca6ee59782268ce3a52d9 |
File details
Details for the file featuretools_sklearn_transformer-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: featuretools_sklearn_transformer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62b0b26968e5e5e3e50c84e89e7e5519ff2f3edbdf207cb25d067a91b78c6b65 |
|
MD5 | c6304cc1eead667bb68f5a4471e6f888 |
|
BLAKE2b-256 | 8b8d51d7cd6250a77a757813eef7b563c036c1a70961ff9d5eca1909174b762d |