Skip to main content

No project description provided

Project description

Deep Feature Synthesis in Rust

This is a project to implement the Deep Feature Synthesis algorithm in Rust.

Running in Python

Create virtualenv

python -m venv .env
source .env/bin/activate
pip install maturin
pip install featuretools
pip install pandas

Ensure Cargo.toml is configured

[lib]
name = "rust_dfs"
crate-type = ["cdylib"]

Run maturin

maturin develop

Using from python

# Import Featuretools, rust_dfs, and some other utility functions
import featuretools as ft
from py.utils import *
import rust_dfs

# Generate a fake dataset with 2 Integer columns
df = generate_fake_dataframe(
    n_rows=10,
    col_defs=[
        ("Integer", 2),
        # ("Boolean", 2),
    ]
)

# pick some primitives
f_primitives = [
    ft.primitives.GreaterThan,
    ft.primitives.LessThan
]

# or use all of them
# f_primitives = list(ft.primitives.utils.get_transform_primitives().values())

# convert datafame to an entityset
es = df_to_es(df)

# run dfs with features_only=True
ft_feats = ft.dfs(
    entityset=es, 
    target_dataframe_name="nums", 
    trans_primitives=f_primitives, 
    features_only=True,
    max_depth=1
)

# ft_feats = [<Feature: F_0>, <Feature: F_1>, <Feature: F_0 > F_1>, <Feature: F_1 > F_0>]

# Convert back into a format that we can use to compare with rust
c_feats = convert_features(ft_feats)

# Now run using Rust

# convert featuretools primitives to rust primitives
r_primitives = convert_primitives(f_primitives)

# convert dataframe to rust features
r_features = dataframe_to_features(es.dataframes[0])

# generate engineered features using Rust (create new features only)
r_derived_feats = rust_dfs.generate_features(r_features, r_primitives)

# r_derived_feats = [GreaterThan_F_0_F_1 : Unknown : Unknown, GreaterThan_F_1_F_0 : Unknown : Unknown]

Run main.rs

To run as a rust binary:

cargo run --no-default-features

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

rust_dfs-0.1.0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rust_dfs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (295.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

rust_dfs-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (295.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rust_dfs-0.1.0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.20

File hashes

Hashes for rust_dfs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 517283642e6ae0c85d8a66c721a0aacce626df1a3bfa5988afe5f1a56a69f150
MD5 8e08c9e34ff7f5982ab908d04bffcfe2
BLAKE2b-256 4d8af6074fdac960663ec090112cacc8026ef8d0f98c843fd759b39f79b0747d

See more details on using hashes here.

File details

Details for the file rust_dfs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rust_dfs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa15f3791a1edc4ca41e0fac5240fd7aa1c468341bf6ba731324cc488aa16900
MD5 72a939749ab221a433b96275370736b1
BLAKE2b-256 31dfc8b3702ec32429fd99328e57f659ff173f54d585558ba1fca550d61826ea

See more details on using hashes here.

File details

Details for the file rust_dfs-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rust_dfs-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab5ddd90b6454c81d86b9ceb6dfa13599b56d800b05017faed11c4c3b12af709
MD5 1e9ffd5a8e77c00ae9a01226cc8e5133
BLAKE2b-256 e43bc98338dfa236ad8d00b8247957a5e1e9130d536fdb4b897a9eb1ff0956b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page