Skip to main content

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

Project description

mlforgex PyPI Downloads

mlforgex is a Python package that enables easy training, evaluation, and prediction for machine learning models on cleaned dataset. 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 mlforgex

stall .


## Requirements

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

See [requirements.txt](requirements.txt) for details.

## Usage

### Train a Model

You can train a model using the CLI:

```sh
mlforge-train --data_path path/to/your/data.csv --dependent_feature TargetColumn --rmse_prob 0.3 --f1_prob 0.7 --n_jobs -1 --n_iter 100 --cv 3

Or programmatically:

from mlforge import train_model

train_model(
    data_path=<data_path>,
    dependent_feature=<dependent_feature>,
    rmse_prob=<rmse_probability>,
    f1_prob=<f1_probability>,
    n_jobs=<n_jobs>
    n_iter=<n_iter>,
    n_splits=<n_splits>,
    artifacts_dir=<artifacts_folder_path>,
    fast=<train_fast>
)

Predict

Use the CLI:

mlforge-predict --model_path path/to/model.pkl --preprocessor_path path/to/preprocessor.pkl --input_data path/to/input.csv --encoder_path path/to/encoder.pkl

Or programmatically:

from mlforge import predict

result = predict(
    <model.pkl>,
    <preprocessor.pkl>,
    <input_data.csv>,
    <encoder.pkl>
)
print(result)

Artifacts

After training, the following files are saved :

  • 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/

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.10.tar.gz (14.2 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.10-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlforgex-1.0.10.tar.gz
  • Upload date:
  • Size: 14.2 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.10.tar.gz
Algorithm Hash digest
SHA256 31d6078c19f7bd6e2fdd34c9037deef8964b4cfbf67d6eccb17666f51ab1c6b5
MD5 3761871d932963dc5b0dcf88c21fefe9
BLAKE2b-256 67e322e9907df8943def67a250180a916624fe957546535a1eab07e143014731

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mlforgex-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 13.1 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4b3f1988b149708d35ba3a55913a2b66f9f43d15c4a8b41a0979b058295f26
MD5 ed31f321bc29e47105dee48071027f26
BLAKE2b-256 bdc29abd687bf645c8ae18bd1702dff8f05f0e2a4704e1f85038e96f3ec3d7ca

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