Skip to main content

Batwing ML Library

Modular, functional, and interpretable machine learning pipeline for classification, multiclass, and regression tasks. Designed for data scientists who want rapid experimentation, clean diagnostics, and powerful model comparisons — all with minimal code.


🚀 Features

  • Full EDA and column-level diagnosis
  • Modular preprocessing (impute, encode, scale)
  • Feature engineering with PCA and correlation filtering
  • Hyperparameter tuning with Optuna (classification, regression, multiclass)
  • Nested Cross-Validation for robust model benchmarking
  • Rich model evaluation (metrics + visualizations)
  • Supports cost-sensitive classification and diagnostics
  • Dashboard/notebook-friendly outputs (HTML/tabulate/rich)

📦 Installation

Coming soon to PyPI

For now, clone the repo and import functions directly:

git clone https://github.com/your-org/batwing-ml.git
from batwing_ml import (
    summary_dataframe,
    preprocess_dataframe,
    run_nested_cv_classification,
    evaluate_classification_model,
    ...
)

🧠 Module Overview

Module Key Functions
exploratory.py summary_dataframe(), summary_column() – full EDA, missing patterns, plots
data_validation_and_etl.py Data shape, type, duplication checks
data_preparation.py Label transformation, type casting, etc.
feature_engineering.py PCA, correlation pruning, importance plots
preprocessor.py preprocess_dataframe(), preprocess_column() – encode, scale, impute
hyperparameter_tuning_classification.py Optuna tuning for binary classification
run_nested_cv_classification.py Nested CV with model benchmarking
evaluate_classification_model.py Confusion matrix, ROC, cost-sensitive plots
hyperparameter_tuning_multiclass_classification.py Multiclass Optuna tuning
nested_cv_multiclass_classification.py Nested CV for multiclass tasks
evaluate_multiclass_classification.py Precision, recall, per-class analysis
hyperparameter_tuning_regression.py Optuna tuning for regression
nested_cv_regression.py Nested CV for regression models
evaluate_regression_model.py Regression metrics + diagnostic plots

🔧 Usage Examples

📊 1. Data Summary

summary_dataframe(df, verbose=True, detailing=True, correlation_matrix=True)
summary_column(df, "age", plots=["histogram", "missing_trend"])

⚙️ 2. Preprocessing

X_proc, y_proc, steps = preprocess_dataframe(
    df, target_col="target",
    impute=True, encode="onehot", scale="standard",
    return_steps=True
)

🔁 3. Model Tuning (Binary Classification)

from sklearn.ensemble import RandomForestClassifier
from batwing_ml import hyperparameter_tuning_classification

model_class = RandomForestClassifier
param_grid = {
    'n_estimators': lambda trial: trial.suggest_int("n_estimators", 50, 200),
    'max_depth': lambda trial: trial.suggest_int("max_depth", 3, 10)
}

results = hyperparameter_tuning_classification(
    model_class=model_class,
    param_grid=param_grid,
    X=X, y=y,
    scoring='roc_auc'
)

🏁 4. Nested Cross-Validation (Regression)

models = {
    "ridge": Ridge(),
    "rf": RandomForestRegressor()
}
param_grids = {
    "ridge": {"alpha": [0.1, 1.0, 10]},
    "rf": {"n_estimators": [100, 200], "max_depth": [3, 5]}
}

run_nested_cv_regression(
    X=X, y=y,
    model_dict=models,
    param_grids=param_grids,
    scoring_list=["r2", "rmse", "mae"],
    search_method="grid",
    return_results=True
)

📈 Visualizations

  • Feature Importance
  • Correlation Heatmaps
  • PCA Scree and Scatter Plots
  • Confusion Matrix, ROC, Threshold Plots
  • Learning Curve, Residuals, Prediction vs Actual
  • Lift Charts, Cost-Sensitive Curves

📚 License

MIT License


👥 Contributors

Built by [Your Name] and contributors.


💡 Future Additions

  • AutoML wrappers
  • MLflow integration
  • HTML dashboard export
  • Time series module

Metadata

Release files for batwing-ml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for batwing-ml 0.1.0
File Size Uploaded Provenance
batwing_ml-0.1.0.tar.gz 64.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for batwing-ml 0.1.0
File Interpreter ABI Platform
batwing_ml-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 145.8 kB

Release files / batwing_ml-0.1.0.tar.gz

Download URL batwing_ml-0.1.0.tar.gz
Size 64.9 kB
Tags Source
SHA-256 checksum
How to use checksums
673dd2e2777468065a197863a32c78e9332efc7ac966fd08fbcf2ed15f78e6c6
BLAKE2b-256 checksum
How to use checksums
dbcdd9e255911a9c9aec2151e5deabfe6bc5b03bb8281d30f7dbc822da2da402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.9

Release files / batwing_ml-0.1.0-py3-none-any.whl

Download URL batwing_ml-0.1.0-py3-none-any.whl
Size 80.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03b3d06d61abcb66c13d5e3da372e74763cc00dfc5e95d6726c00fa14af6a4af
BLAKE2b-256 checksum
How to use checksums
2f4059130c6eaeae17ec61b63cb1381558b8ced0a0f9fab10587515723dcf821
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.9

Security for batwing-ml 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page