Skip to main content

Automatic feature engineering, insights, and sklearn pipelines for tabular ML with optional time-series support.

Project description

FeatureCraft

Automatic feature engineering, insights, and sklearn pipelines for tabular ML with optional time-series support.

Python 3.9+ License: MIT PyPI version

Table of Contents

About The Project

FeatureCraft is a comprehensive feature engineering library that automates the process of transforming raw tabular data into machine learning-ready features. It provides intelligent preprocessing, feature selection, encoding, and scaling tailored for different estimator families.

Key Features

Automatic Feature Engineering: Intelligent preprocessing pipeline that handles missing values, outliers, categorical encoding, and feature scaling

🔍 Dataset Analysis: Comprehensive insights into your data including distributions, correlations, and data quality issues

🔮 Explainability & Transparency: Detailed explanations of why and how transformations are applied, with rich console output and export capabilities

📊 Multiple Estimator Support: Optimized preprocessing for tree-based models, linear models, SVMs, k-NN, and neural networks

🛠️ Sklearn Integration: Seamless integration with scikit-learn pipelines and ecosystem

📈 HTML Reports: Interactive visualizations and insights reports

CLI & Python API: Choose between command-line interface or programmatic usage

🕐 Time Series Support: Optional time-series aware preprocessing

Why FeatureCraft?

  • Automated Workflow: No need to manually handle different data types and preprocessing steps
  • Best Practices: Implements proven feature engineering techniques
  • Performance Optimized: Different preprocessing strategies for different model types
  • Production Ready: Exports sklearn-compatible pipelines for deployment
  • Comprehensive Analysis: Deep insights into your dataset characteristics
  • Explainable AI: Understand why transformations are applied and how they affect your data
  • Transparency: Rich explanations help build trust and debug preprocessing decisions

Getting Started

Prerequisites

  • Python 3.9 or higher
  • pandas >= 1.5
  • scikit-learn >= 1.3
  • numpy >= 1.23

Installation

# Basic installation
pip install featurecraft

# With optional extras for enhanced functionality
pip install "featurecraft[extras]"

# Full installation with all dependencies
pip install "featurecraft[all]"

Usage

CLI Usage

# Analyze dataset and generate comprehensive report
featurecraft analyze --input data.csv --target target_column --out artifacts/

# Fit preprocessing pipeline and transform data
featurecraft fit-transform --input data.csv --target target_column --out artifacts/ --estimator-family tree

# Open the generated HTML report
open artifacts/report.html

Python API

import pandas as pd
from featurecraft.pipeline import AutoFeatureEngineer

# Load your data
df = pd.read_csv("your_data.csv")

# Initialize the feature engineer
afe = AutoFeatureEngineer()

# Analyze dataset (optional but recommended)
summary = afe.analyze(df, target="target_column")
print(f"Detected task: {summary.task}")
print(f"Found {len(summary.issues)} data quality issues")

# Prepare features and target
X, y = df.drop(columns=["target_column"]), df["target_column"]

# Fit and transform with estimator-specific preprocessing
Xt = afe.fit_transform(X, y, estimator_family="tree")
print(f"Transformed {X.shape[1]} features into {Xt.shape[1]} features")

# Export pipeline for production use
afe.export("artifacts")

# Access detailed explanations (optional)
explanation = afe.get_explanation()
afe.print_explanation()  # Rich console output
afe.save_explanation("artifacts/explanation.md", format="markdown")

Estimator Families

Choose the preprocessing strategy based on your model type:

Family Models Scaling Encoding Best For
tree XGBoost, LightGBM, Random Forest None Label Encoding Tree-based models
linear Linear/Logistic Regression StandardScaler One-hot + Target Linear models
svm SVM, SVC StandardScaler One-hot Support Vector Machines
knn k-Nearest Neighbors MinMaxScaler Label Encoding Distance-based models
nn Neural Networks MinMaxScaler Label Encoding Deep learning

Configuration

Customize the preprocessing behavior:

from featurecraft.config import FeatureCraftConfig

# Custom configuration
config = FeatureCraftConfig(
    low_cardinality_max=15,        # Max unique values for low-cardinality features
    outlier_share_threshold=0.1,   # Threshold for outlier detection
    random_state=42,               # For reproducible results
    explain_transformations=True,  # Enable detailed explanations (default: True)
    explain_auto_print=True        # Auto-print explanations after fitting (default: True)
)

afe = AutoFeatureEngineer(config=config)

Output Artifacts

The export() method creates:

  • pipeline.joblib: Fitted sklearn Pipeline ready for production
  • metadata.json: Configuration and processing summary
  • feature_names.txt: List of all output feature names
  • explanation.md: Human-readable explanation of transformation decisions (when explanations enabled)
  • explanation.json: Machine-readable explanation data (when explanations enabled)

The analyze() method generates:

  • report.html: Interactive HTML report with plots, insights, and recommendations

Examples

Check out the examples directory for comprehensive usage examples:

Run the quickstart example:

cd examples
python 01_quickstart.py --cases iris,wine,breast_cancer --artifacts ../artifacts

Documentation

Getting Started

Configuration & Optimization

Advanced Topics

Roadmap

See the open issues for a list of proposed features and known issues.

  • Enhanced time series preprocessing
  • Feature selection algorithms
  • Integration with popular ML frameworks
  • GPU acceleration support
  • Advanced outlier detection methods
  • Automated feature interaction detection

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

Don't forget to give the project a star! Thanks again!

License

Distributed under the MIT License. See LICENSE for more information.


Built with ❤️ for the machine learning community

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

featurecraft-0.1.0.tar.gz (77.0 kB view details)

Uploaded Source

Built Distribution

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

featurecraft-0.1.0-py3-none-any.whl (90.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: featurecraft-0.1.0.tar.gz
  • Upload date:
  • Size: 77.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for featurecraft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b9744c93a9754526e63011d7893081256c4dfae2fc5cab17078c9bd4dbe5a57f
MD5 1c1c0f4b19cd2de27740eef596094f45
BLAKE2b-256 4570715bfecce3452ae162c083368a161dc907c5f7a1bb7e89ea85422b8c137a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: featurecraft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 90.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for featurecraft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f62e342a3d4c2433543b312ca2d98b72a50a8acf8709c8df92893e5b3795a100
MD5 776049347350bf5762b69e0589e27428
BLAKE2b-256 9e800f85ad76453c7f13b4aa74cd7b6a9b45c6fc5fd6521573dd605a35aa0b63

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