Skip to main content

🔨 ModelForge

A transparent, local-first AutoML framework for Python

PyPI version Python License Tests GitHub

Give it a dataset and a target column. It handles the rest — transparently.

Installation • Quick Start • Configuration • Architecture • Stress Test Results • Roadmap


What is ModelForge?

ModelForge is a local-first AutoML framework that automates the repetitive parts of a machine learning workflow — data profiling, quality auditing, preprocessing, pipeline construction, model evaluation, cross-validation, ranking, and reporting — while staying inspectable at every step.

Unlike black-box AutoML tools, ModelForge is built around one core principle:

You should always be able to see what it did and why.

Give it a dataset and a target column:

import pandas as pd
from modelforge.automl import AutoML

df = pd.read_csv("dataset.csv")

automl = AutoML()
automl.fit(df, target="target_column")

And it walks through the full pipeline automatically:

Dataset → Loading → Profiling → Data Quality Audit → Target/Task Detection
        → Column Intelligence → Feature Selection/Engineering → Preprocessing
        → Pipeline Generation → Multi-Model Evaluation → Cross-Validation
        → Metric Calculation → Model Ranking → Best Model Selection
        → (Optional) Hyperparameter Optimization → Explainability
        → Persistence/Artifacts → Experiment Tracking → Human-Readable Report

Installation

pip install autoforge-engine

Install a specific version:

pip install autoforge-engine==1.0.1

Verify the install:

pip show autoforge-engine
python -c "import modelforge; print(modelforge.__file__)"

Note: the PyPI distribution name is autoforge-engine, but the importable package is modelforge.


Quick Start

Using the AutoML class

import pandas as pd
from modelforge.automl import AutoML

df = pd.read_csv("autoforge_10000_test_dataset.csv")

automl = AutoML()
automl.fit(df, target="loan_default")

Using the convenience function

from modelforge.automl import automl

result = automl(
    data=df,
    target="loan_default"
)

Command line

modelforge --help

Selecting and Exporting a Model

ModelForge evaluates and ranks candidate models automatically. By default, best_model / best_pipeline hold the top-ranked result, and save() persists that automatically recommended pipeline.

You can override the recommendation after fit() without re-running AutoML. The selected candidate is refitted on the full training dataset before it is used for prediction or export. The exported artifact is the complete scikit-learn pipeline (preprocessing + estimator). Metadata records how the model was selected.

Automatic behavior

automl.fit(df, target="target")
automl.save("best_model.joblib")

Select by rank

automl.fit(df, target="target")

automl.select_model(rank=2)

automl.export_model(
    "selected_model.joblib"
)

Select by model name

automl.select_model(
    model="random_forest_classifier"
)

automl.export_model(
    "random_forest_model.joblib"
)

Notes:

  • best_model remains the automatically ranked best model.
  • selected_model / selected_pipeline hold the user override.
  • After select_model(), predict() and predict_proba() use the selected pipeline. Before selection they continue to use the best pipeline.
  • save() always saves the automatically ranked best model.
  • export_model() saves the selected model when one was chosen; otherwise it saves the best model.

CLI selection

Export a ranked model without changing the default train workflow:

modelforge train \
    --data data.csv \
    --target target \
    --model-rank 2 \
    --output random_forest_model.joblib

Or select by registry model name:

modelforge train \
    --data data.csv \
    --target target \
    --model random_forest_classifier \
    --output random_forest_model.joblib

Existing modelforge train commands without --model / --model-rank continue to save the automatically recommended best model.

Configuration

The AutoML constructor supports the following parameters:

AutoML(
    test_size=0.2,
    cv=5,
    random_state=42,
    objective="balanced",
    variance_threshold=None,
    correlation_threshold=None,
    enable_optimization=False,
    optimization_models=3,
    optimization_max_trials=10,
    experiment_directory=".modelforge/experiments",
    config=None
)
Parameter Description
test_size Holdout test fraction
cv Number of cross-validation folds
random_state Reproducibility seed
objective Model ranking objective (default: "balanced")
variance_threshold Optional low-variance feature filtering
correlation_threshold Optional high-correlation feature filtering
enable_optimization Enables/disables hyperparameter optimization
optimization_models Number of models considered for optimization
optimization_max_trials Maximum optimization trials
experiment_directory Where experiment metadata/artifacts are stored

The automatic post-fit report can be suppressed with print_report=False (if supported by the installed fit() signature).


What ModelForge Does

🧹 Data Quality Auditing

Automatically flags:

  • Missing values
  • Duplicate rows
  • Constant columns
  • Possible identifier columns
  • Other dataset-quality findings

🎯 Target & Task Detection

Given a target column, ModelForge determines whether the problem is classification or regression.

⚙️ Preprocessing

Builds a leakage-safe scikit-learn Pipeline / ColumnTransformer:

Data type Steps
Numerical SimpleImputer → StandardScaler
Categorical SimpleImputer → OneHotEncoder

Preprocessing is fit independently inside each cross-validation fold to prevent data leakage.

🤖 Model Evaluation

Evaluates multiple candidate models (verified against source for the current release), including — for classification tasks — Logistic Regression, Random Forest, Extra Trees, Gradient Boosting, K-Nearest Neighbors, Support Vector Classifier, and Decision Tree.

🔁 Cross-Validation

Uses StratifiedKFold (n_splits=5, shuffle=True, random_state=42) for classification tasks where class counts permit. Each fold clones the pipeline fresh, fits on the training split, and evaluates on the validation split.

📊 Metrics

Classification: Accuracy, Precision, Recall, F1 (average="weighted", zero_division=0), ROC-AUC (via predict_proba or decision_function), Log Loss.

Regression: R², Adjusted R², MAE, MSE, RMSE, MAPE.

🏆 Model Ranking

Candidate models are ranked according to the configured objective (default: "balanced") rather than by a single metric alone.

📄 Automatic Reporting

After fit(), ModelForge generates a human-readable report covering dataset shape, target/task, data-quality findings, evaluated models and metrics, the selected model, pipeline steps, run/experiment IDs, and run duration.


Architecture

ModelForge is organized into focused modules, each with a single responsibility:

Module Responsibility
data_loader.py Dataset loading
profiler.py Dataset profiling
data_audit.py Data quality / auditing
target_selector.py Target and task detection
column_intelligence.py Column-level analysis
feature_engineering.py Feature engineering
feature_selection.py Feature selection
preprocessing.py Imputation, scaling, encoding
pipeline_generator.py sklearn pipeline construction
model_registry.py Candidate model catalog
model_screening.py Fast holdout evaluation
cross_validation.py K-fold cross-validation
evaluation.py Metric computation
ranking.py Model ranking logic
hyperparameter_optimization.py Optional HPO
explainability.py Model explainability
persistence.py Model save/load
artifact_manager.py Artifact management
experiment_tracker.py Experiment tracking
reproducibility.py / reproducibility_integration.py Reproducibility guarantees
prediction_validator.py Prediction-time validation
run_manager.py Run metadata
cli.py Typer-based CLI
automl.py Orchestration layer
config.py Configuration handling

Note on Model Screening vs. Cross-Validation: these are distinct evaluation paths. ModelScreeningEngine performs a fast train_test_split (80/20, stratified where applicable) holdout evaluation, while CrossValidationEngine performs full K-fold evaluation. Holdout screening metrics and CV metrics should not be conflated.


Stress Test Results

ModelForge 0.1.4 was validated against a synthetic 10,020-row, 18-column dataset (target: loan_default) intentionally containing missing values, duplicates, a constant feature, and an identifier-like column.

Data quality detected: 1,000 missing cells · 20 duplicate rows · 3 quality findings (all correctly identified)

Cross-validation accuracy:

Model CV Accuracy
Logistic Regression 69.51%
Gradient Boosting 69.51%
SVC 69.12%
Random Forest 69.02%
Extra Trees 68.26%
KNN 64.52%
Decision Tree 58.59%

Selected model: Logistic Regression · Run time: ~33.25 seconds

These figures are a functional stress-test snapshot, not a claim that any single algorithm is universally best.

Independent Validation

Results were cross-checked against raw scikit-learn implementations. Six of seven models matched almost exactly; Decision Tree showed a ~0.13 percentage-point difference (58.59% vs. 58.72%), currently logged as an open, low-priority investigation rather than a confirmed defect.


Testing & Validation

  • ✅ 491 tests passing locally
  • ✅ GitHub Actions CI passing
  • ✅ Package built (.tar.gz + .whl) and validated with twine check
  • ✅ Published to PyPI: autoforge-engine

Test coverage includes unit, integration, CLI, preprocessing, model evaluation, cross-validation, ranking, persistence, experiment tracking, edge cases, and large mixed-type stress tests.


Development Workflow

# Run tests
pytest

# Build the package
python -m build

# Validate the build
python -m twine check dist/*

# Upload to PyPI
python -m twine upload dist/*

Roadmap

  • Investigate the minor Decision Tree CV discrepancy (model_registry / pipeline_generator / preprocessing)
  • Expand hyperparameter optimization coverage
  • Broaden regression model support
  • Deepen explainability outputs
  • Continued CLI and documentation improvements

Philosophy

ModelForge is built to demonstrate serious ML engineering practice — not to replace a data scientist's judgment. It automates repeatable, mechanical steps of an ML workflow (preprocessing, evaluation, cross-validation, ranking, reporting) while keeping every step reproducible and inspectable, so the framework never becomes a black box.


Author

Aditya Kumar Singh

License

Apache License 2.0

Metadata

Release files for autoforge-engine 1.0.2

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

Source distribution (sdist)

Source distribution for autoforge-engine 1.0.2
File Size Uploaded Provenance Actions
autoforge_engine-1.0.2.tar.gz 100.2 kB With provenance Details for autoforge_engine-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autoforge-engine 1.0.2
File Interpreter ABI Platform Actions
autoforge_engine-1.0.2-py3-none-any.whl Python 3 none any Details for autoforge_engine-1.0.2-py3-none-any.whl

Total release size: 176.0 kB

Release files / autoforge_engine-1.0.2.tar.gz

Download URL autoforge_engine-1.0.2.tar.gz
Size 100.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e4661670a152cf41fededf91f68802fc0044069653807f8c34d309e69528e41b
BLAKE2b-256 checksum
How to use checksums
162a80f4e998ae380a7b7e01c5d42199fe784338ce42cad6ab0012f4151c0d71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / autoforge_engine-1.0.2-py3-none-any.whl

Download URL autoforge_engine-1.0.2-py3-none-any.whl
Size 75.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e65ad77c30d19f5457e60836e30c5d55c1f6788f848ca68a0d82c5eea4c26fa2
BLAKE2b-256 checksum
How to use checksums
ab3c7c609aeef5ac473892e065e1daeee52d41aece84b4511a9ca939dc6d1962
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for autoforge-engine 1.0.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for autoforge_engine-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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