Automated Feature Engineering + Data Profiling + Leakage Detection
Project description
AutoFE-X: Automated Feature Engineering + Data Profiling + Leakage Detection
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
from sklearn.preprocessing import FunctionTransformer
from autofex import FeatureEngineer
# Option 1: Using FunctionTransformer
def your_custom_function(X):
# Your custom transformation logic
# Example: square all numeric columns
X_transformed = X.copy()
numeric_cols = X.select_dtypes(include=['number']).columns
for col in numeric_cols:
X_transformed[col + '_squared'] = X[col] ** 2
return X_transformed
custom_transformer = FunctionTransformer(func=your_custom_function)
X_custom = custom_transformer.fit_transform(X)
# Option 2: Custom transformer class
class CustomTransformer:
def fit(self, X, y=None):
return self
def transform(self, X):
# Your custom logic
X_transformed = X.copy()
numeric_cols = X.select_dtypes(include=['number']).columns
for col in numeric_cols:
X_transformed[col + '_custom'] = X[col] * 2
return X_transformed
custom_trans = CustomTransformer()
custom_trans.fit(X, y)
X_custom = custom_trans.transform(X)
# Use FeatureEngineer for standard transformations
fe = FeatureEngineer()
X_engineered = fe.fit_transform(X, y)
📈 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.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- 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
- Documentation: See the
docs/directory for comprehensive guides - Issues: GitHub Issues
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autofex-0.1.2.tar.gz.
File metadata
- Download URL: autofex-0.1.2.tar.gz
- Upload date:
- Size: 92.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86c7d6dc7af738c7ab13d2fb657b5f2c98a3623da10d0718d43fca7d6044e88c
|
|
| MD5 |
5dea0226690f5ff743288e920b3cf922
|
|
| BLAKE2b-256 |
f81717fe3d78d4a8f6fd76042e25d1851bcf77517651680787826d5ce0a77811
|
File details
Details for the file autofex-0.1.2-py3-none-any.whl.
File metadata
- Download URL: autofex-0.1.2-py3-none-any.whl
- Upload date:
- Size: 102.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afbdfad4494c267f924078231ba8790e4e55aca8b26ed7741c7c7098dc455fa0
|
|
| MD5 |
7f4034aae13c03ce460136f744b76db7
|
|
| BLAKE2b-256 |
1a77560b600ae7cfc43d4e15566cfe96ef42b15561418fe2572ffe1486c86122
|