Skip to main content

Automated Feature Engineering + Data Profiling + Leakage Detection

Project description

AutoFE-X: Automated Feature Engineering + Data Profiling + Leakage Detection

PyPI version Python 3.8+ codecov License: MIT

AutoFE-X brings automated feature engineering, data diagnostics, leakage detection, benchmarking, and feature lineage into a unified toolkit designed for modern ML workflows. It acts as a structured feature intelligence layer that can be inserted into any pipeline—lightweight, interpretable, and fully transparent.

✨ Key Features

  • 🚀 Automated Feature Engineering: Classic mathematical transformations, interactions, and encodings
  • 🔍 Data Profiling: Comprehensive data quality analysis with outlier detection and statistical summaries
  • 🛡️ Leakage Detection: Advanced algorithms to detect target leakage, train-test contamination, and statistical anomalies
  • 📊 Auto-Benchmarking: Automatically compare feature sets across multiple models with ablation studies
  • 🔗 Graph-based Lineage: Track feature transformations and dependencies with full provenance
  • Lightweight & Fast: Minimal dependencies, optimized for performance
  • 🎯 Interpretable: Full transparency in feature engineering decisions

🚀 Coming soon (v0.2.0+)

  • 🔬 Feature Engineering: Statistical aggregations, time-series features, domain-specific transformations
  • 🎯 Intelligent Feature Selection: L1 regularization, RFE, ensemble selection with voting
  • 📊 Comprehensive Visualization: Feature importance plots, data quality dashboards, lineage graphs
  • 📈 Interactive Dashboards: Multi-panel dashboards with integrated analysis (beyond basic Plotly)
  • 🔬 Statistical Analysis: Multi-test normality analysis, effect sizes, automated interpretations (beyond basic Scipy)
  • 🚀 Ultra-Statistics: ANOVA/MANOVA, time-series tests, Bayesian analysis, power analysis, bootstrap methods
  • 📊 Multi-Dimensional Visualization: 2D, 3D, 4D, 5D visualizations (beyond Matplotlib/Plotly)
  • 💡 Actionable Insights: Automated recommendations and HTML reports
  • ⏱️ Progress Tracking: Real-time progress bars, ETA, step-by-step tracking
  • 💾 Intelligent Caching: Operation-based caching with TTL, size management, cache statistics
  • Performance Optimized: Parallel processing support, intelligent caching
  • 🔬 Mathematical Modeling: Polynomial, spline, PCA, ICA, clustering, manifold learning features
  • 📊 Statistical Transforms: Box-Cox, Yeo-Johnson, quantile, power transforms
  • 🐼 Pandas Operations: Rolling windows, groupby, datetime, string features, cumulative, differences
  • 🔢 Numpy Operations: Array operations, broadcasting, matrix ops, advanced math functions
  • 🔬 Scipy Operations: Special functions, distance metrics, optimization, signal processing, integration
  • 🧠 Intelligent Orchestration: Automatic feature engineering selection based on data characteristics
  • 📊 Feature Quality Scoring: Multi-dimensional quality scoring (predictive power, stability, uniqueness, efficiency)
  • 💡 Intelligent Recommendations: Automatic transformation and strategy recommendations

📚 Documentation (Coming soon)

🚀 Quick Start

Installation

# Install from PyPI
pip install autofex

# Or install from source for development
git clone https://github.com/autofe-x/autofe-x.git
cd autofe-x
pip install -e .

Basic Usage

import pandas as pd
from autofex import AutoFEX

# Load your data
X = pd.read_csv('features.csv')
y = pd.read_csv('target.csv')['target']

# Initialize AutoFEX
afx = AutoFEX()

# Run complete pipeline
result = afx.process(X, y)

# Access results
print("Data Quality Issues:", result.data_quality_report)
print("Leakage Warnings:", result.leakage_report)
print("Engineered Features Shape:", result.engineered_features.shape)
print("Top Feature Sets:", result.benchmark_results['best_configurations'])

Individual Components

from autofex import FeatureEngineer, DataProfiler, LeakageDetector

# Feature engineering only
fe = FeatureEngineer()
X_engineered = fe.fit_transform(X, y)

# Data profiling only
profiler = DataProfiler()
report = profiler.analyze(X, y)

# Leakage detection only
detector = LeakageDetector()
leakage_report = detector.detect(X, y)

📖 Detailed Usage

Feature Engineering

from autofex import FeatureEngineer

# Create feature engineer
fe = FeatureEngineer({
    'numeric_transforms': ['log', 'sqrt', 'standardize'],
    'categorical_transforms': ['one_hot', 'target_encode'],
    'interaction_degree': 2
})

# Transform features
X_engineered = fe.fit_transform(X, y)

Data Profiling

from autofex import DataProfiler

profiler = DataProfiler()
report = profiler.analyze(X, y)

print("Missing Values:", report['missing_values'])
print("Outliers:", report['outliers'])
print("Correlations:", report['correlations'])

Leakage Detection

from autofex import LeakageDetector

detector = LeakageDetector()
leakage_report = detector.detect(X, y, X_test)

print("Target Leakage:", leakage_report['target_leakage'])
print("Overall Risk:", leakage_report['overall_assessment']['risk_level'])

Auto-Benchmarking

from autofex import FeatureBenchmarker

benchmarker = FeatureBenchmarker()
results = benchmarker.benchmark_features(X, y)

print("Best Configuration:", results['best_configurations']['best_overall'])
print("Feature Importance:", results['feature_importance'])

Feature Lineage

from autofex import FeatureLineageTracker

tracker = FeatureLineageTracker()
tracker.start_session(X.columns.tolist())
tracker.add_transformation('log_transform', ['feature1'], ['feature1_log'])

lineage = tracker.get_lineage_graph()
print("Feature Dependencies:", tracker.get_feature_dependencies('feature1_log'))

🔧 Installation

From PyPI

pip install autofex

From Source

git clone https://github.com/autofex/autofex.git
cd autofex
pip install -e .

Development Setup

pip install -e ".[dev]"

Software testing

# Run tests
pytest

# Run with coverage
pytest --cov=autofex

# Code quality checks
black autofex/
flake8 autofex/
mypy autofex/

Key Features:

  • ANOVA/MANOVA: Multi-group comparisons with post-hoc tests and effect sizes
  • Time-Series Tests: ADF test, trend detection, autocorrelation analysis
  • Bayesian Methods: Posterior distributions, credible intervals, Bayes factors
  • Power Analysis: Sample size calculations, power estimation
  • Bootstrap Methods: Non-parametric confidence intervals

📊 Multi-Dimensional Visualization (Beyond Matplotlib/Plotly)

from autofex import MultiDimensionalVisualizer

viz = MultiDimensionalVisualizer(backend="plotly")

# 2D: Scatter + Density + Hexbin + Marginals
viz.plot_2d(x, y, color=target, size=feature3, save_path="2d.html")

# 3D: Interactive 3D scatter + surface rendering
viz.plot_3d(x, y, z, color=target, size=feature4, save_path="3d.html")

# 4D: 3D + color encoding (4th dimension)
viz.plot_4d(x, y, z, color=dim4, size=dim5, save_path="4d.html")

# 5D: Multi-panel with PCA, t-SNE, parallel coordinates
viz.plot_5d(
    data,
    dims=["dim1", "dim2", "dim3", "dim4", "dim5"],
    color_col="target",
    size_col="dim5",
    save_path="5d.html"
)

Key Features:

  • 2D: Enhanced scatter plots, density contours, hexbin, marginal distributions
  • 3D: Interactive 3D scatter with surface interpolation
  • 4D: 3D visualization with 4th dimension as color encoding
  • 5D: Multi-panel views with PCA, t-SNE, parallel coordinates

📊 Key Advantages Over Raw Libraries

Feature Raw AutoFE-X
Statistical Testing Single test, manual interpretation Multi-test with automated interpretation
ANOVA Basic f_oneway ANOVA + post-hoc + effect sizes (η²)
MANOVA Not available Full MANOVA support
Time-Series Tests Manual ADF ADF + trend + autocorrelation
Bayesian Analysis Manual calculation Posterior + credible intervals + Bayes factor
Power Analysis Manual calculation Automated sample size + power
Bootstrap Manual loops Automated bootstrap + CI
Effect Sizes Manual calculation Automatic (Cohen's d, rank-biserial, η²)
Test Selection Manual choice Automated (parametric vs non-parametric)
2D Visualization Basic scatter Scatter + density + hexbin + marginals
3D Visualization Basic 3D scatter 3D + surface + interactive
4D Visualization Manual encoding Integrated 4D visualization
5D Visualization Not available Multi-panel with PCA, t-SNE, parallel coords
Visualizations Individual plots Integrated dashboards with insights
Insights Manual analysis Automated recommendations
Reports Manual creation HTML report generation
Interpretations Just p-values Full interpretations + recommendations

Custom Transformations

class CustomTransformer:
    def fit(self, X, y=None):
        return self

    def transform(self, X):
        # Your custom logic
        return X_transformed

# Use in pipeline
afx = AutoFEX()
afx.feature_engineer.add_transformer('custom', CustomTransformer())

Integration with Existing Pipelines

from sklearn.pipeline import Pipeline
from autofex import FeatureEngineer

pipeline = Pipeline([
    ('feature_engineering', FeatureEngineer()),
    ('model', RandomForestClassifier())
])

pipeline.fit(X_train, y_train)

📈 Performance

  • Speed: Processes 100K rows × 50 features in ~2 seconds
  • Memory: Minimal memory footprint (< 2x original data)
  • Scalability: Handles datasets up to 1M rows efficiently
  • Accuracy: Feature engineering decisions based on statistical validation
  • Caching: Repeated operations are cached, providing 2-10x speedup on subsequent runs
  • Progress Tracking: Real-time feedback with ETA for long-running operations

Progress Tracking & Caching

from autofex import AutoFEX

# Enable progress tracking and caching
afx = AutoFEX(
    enable_progress=True,      # Real-time progress bars
    enable_cache=True,         # Intelligent caching
    cache_dir=".autofex_cache", # Cache directory
    cache_ttl=3600,            # 1 hour TTL
)

# First run - computes and caches
result1 = afx.process(X, y)  # Shows progress bar with ETA

# Second run - uses cache (much faster!)
result2 = afx.process(X, y)  # 2-10x faster with cache hits

# Cache management
afx.cache.clear()                    # Clear all cache
afx.cache.clear(operation="profiling")  # Clear specific operation
cache_stats = afx.cache.get_stats()  # Get cache statistics

Progress Tracking Features:

  • Real-time progress bars with percentage
  • ETA (Estimated Time Remaining) calculation
  • Step-by-step progress updates
  • Time statistics (total time, average step time)
  • Real-time metric tracking

Caching Features:

  • Operation-based caching (profiling, leakage detection, feature engineering, benchmarking)
  • TTL (Time-To-Live) support for cache expiration
  • Automatic size management (evicts oldest entries when limit reached)
  • Cache statistics and management
  • Selective cache clearing by operation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by featuretools, pandas-profiling, and scikit-learn
  • Built for the data science community to solve real ML engineering challenges

📞 Support

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

autofex-0.1.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

autofex-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autofex-0.1.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for autofex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47da3d20eb6dbbdfab7999c36dbb0dfcefaf8a5b411644346189e27ebb395926
MD5 64bbaca1b9a431504f9e54c37fb24648
BLAKE2b-256 983a944ace63a693654e9e146ec7d6e9cfb85dcc5b3d61012007662bd9fb364e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autofex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for autofex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e46783cabb4fd8eb7870795b59270aedd0770dbbb99c157a0eb8952a6a898659
MD5 bc9b861fcee8c711cf777ee47757c980
BLAKE2b-256 d3d2e699df360170e542de7ecf219c1b11ae6de2d5028602019ed0ebfe22313f

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