Skip to main content

A simple library to train, manage, and use multiple ML models easily.

Project description

ml_model_manager

A lightweight Python package for training, managing, and predicting with multiple machine learning models.
Supports classical ML algorithms, pipelines, ensemble learning (Voting), and user-defined custom estimators.


Features

  • Preconfigured ML models: Logistic Regression, KNN, Naive Bayes, Decision Tree, Random Forest, Gradient Boosting, XGBoost, SVM, SGD.
  • Voting Classifier support (soft/hard voting).
  • Plug-and-play with custom estimators.
  • Built-in pipelines with StandardScaler where useful.
  • Easy single prediction and batch predictions.
  • Probability predictions (predict_proba) when available.

Installation

pip install ml-model-manager

Quick Start

import pandas as pd
from ml_model_manager import MLModelManager

# Example dataset
X = pd.DataFrame({
    "feature1": [1, 2, 3, 4],
    "feature2": [10, 20, 30, 40]
})
y = [0, 1, 0, 1]

# Initialize manager
manager = MLModelManager()

# Train default models
manager.train_models(X, y)

# Single prediction
print(manager.predict("logistic", {"feature1": 5, "feature2": 50}))

# Batch prediction
print(manager.batch_predict("knn", [
    {"feature1": 6, "feature2": 60},
    {"feature1": 2, "feature2": 25}
]))

# Probability prediction
print(manager.predict_proba("logistic", {"feature1": 5, "feature2": 50}))

Voting Classifier

The voting estimator combines predictions from multiple trained models (soft or hard voting).

# Use Logistic, KNN and Voting
manager.train_models(X, y, estimators=["logistic", "knn", "voting"], voting_type="soft")

print(manager.predict("voting", {"feature1": 7, "feature2": 70}))

⚠️ If fewer than 2 base models are given with voting, it falls back to all trained models with a warning.


Custom Estimators

You can extend with your own models:

from sklearn.linear_model import RidgeClassifier

custom = {
    "ridge": RidgeClassifier()
}

manager.train_models(X, y, estimators=["ridge"])
print(manager.predict("ridge", {"feature1": 8, "feature2": 80}))

Project Structure

ml_model_manager/
 ├── __init__.py
 └── main.py          # MLModelManager class
README.md
setup.py

Contributing

Contributions are welcome!

  • Fork the repo
  • Create a feature branch
  • Submit a pull request

License

MIT License

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

ml_model_manager-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

ml_model_manager-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file ml_model_manager-0.1.1.tar.gz.

File metadata

  • Download URL: ml_model_manager-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for ml_model_manager-0.1.1.tar.gz
Algorithm Hash digest
SHA256 20c818242a14edc35f449522581621ee347bd6717e855eb63faf57e85f1ecfc1
MD5 eba2c6596efe36b5c192bfd59b4b2a25
BLAKE2b-256 a2c2cdc4bade9b085f9e8d7d6a84da77517519d19329e871a71df64f78c5ee2f

See more details on using hashes here.

File details

Details for the file ml_model_manager-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ml_model_manager-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e95d5d00640e74c815334ab98bb68e5dd8e2741260a68c74089a2c61917eef90
MD5 3553401cbdd958965d0cd0b0c0a40012
BLAKE2b-256 bc3e2ec2de19dbbb662f703edbc03e3c8b53ac4bbc37152ba082c653178795e5

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