Skip to main content

Lightweight ML utility for automated training, evaluation, and prediction with CLI and Python API support

Project description

MLForge

MLForge is a Python package that enables easy training, evaluation, and prediction for machine learning models. It supports both classification and regression problems, automates preprocessing, model selection, hyperparameter tuning, and generates useful artifacts and plots for analysis.

Features

  • Automatic data preprocessing (missing value handling, encoding, scaling)
  • Imbalance handling (under-sampling, over-sampling)
  • Model selection and evaluation (classification & regression)
  • Hyperparameter tuning with RandomizedSearchCV
  • Artifact saving (model, preprocessor, encoder)
  • Visualization of metrics and learning curves
  • Simple CLI for training and prediction

Installation

Install MLForge using pip:

pip install mlforge

Or clone the repository and install locally:

git clone https://github.com/yourusername/mlforge.git
cd mlforge
pip install .

Requirements

  • Python >= 3.8
  • pandas
  • numpy
  • scikit-learn
  • seaborn
  • matplotlib
  • xgboost
  • imbalanced-learn

See requirements.txt for details.

Usage

Train a Model

You can train a model using the CLI:

mlforge-train --data mlforge/diabetes_cleaned.csv --target Outcome --rmse 0.3 --f1 0.7

Or programmatically:

from mlforge import train_model

result = train_model(
    "mlforge/diabetes_cleaned.csv",
    "Outcome",
    rmse_prob=0.3,
    f1_prob=0.7,
    n_jobs=-1
)
print(result)

Predict

Use the CLI:

mlforge-predict --model mlforge/artifacts/model.pkl --preprocessor mlforge/artifacts/preprocessor.pkl --input mlforge/input.csv --encoder mlforge/artifacts/encoder.pkl

Or programmatically:

from mlforge import predict

result = predict(
    "mlforge/artifacts/model.pkl",
    "mlforge/artifacts/preprocessor.pkl",
    "mlforge/input.csv",
    "mlforge/artifacts/encoder.pkl"
)
print(result)

Artifacts

After training, the following files are saved in mlforge/artifacts/:

  • model.pkl: Trained model
  • preprocessor.pkl: Preprocessing pipeline
  • encoder.pkl: Label encoder (for classification)
  • Plots/: Visualizations (correlation heatmap, confusion matrix, ROC curve, etc.)

Testing

Run tests using pytest:

pytest test/

License

MIT License

Author

Priyanshu Mathur
Portfolio
Email: mathurpriyanshu2006@gmail.com

Project Links

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

mlforgex-1.0.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

mlforgex-1.0.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file mlforgex-1.0.1.tar.gz.

File metadata

  • Download URL: mlforgex-1.0.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for mlforgex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2009011b10aed46cc1d86c8bda25d1d996b66c3e5ba8908f8ed21c413880b9fa
MD5 93954c8cc711842cc1ac89661527eb20
BLAKE2b-256 b79fd2b13b7bb9c1a3afc6e26ab08406251fbfaaf0b17a584408a130071e38e9

See more details on using hashes here.

File details

Details for the file mlforgex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mlforgex-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for mlforgex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ce2e3b50f657b230ef97b9faba00e48de6b5dae1616b160f5d23e9316c0b8cc
MD5 8d3d12e0beb645a0a8a3e69e7921d04f
BLAKE2b-256 1854a9330939bc182edf96db3b574ef570eb46d2c3cb815f320d8d46a081a67d

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