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.2.tar.gz (4.6 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.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ml_model_manager-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 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.2.tar.gz
Algorithm Hash digest
SHA256 88bd31f0a7c9fce5c95a6c40fe5399d83e9d9c0f81ba7bcc5aa098773f4b8fd2
MD5 627cbc7a2dad7bdd29030a1697bd32ec
BLAKE2b-256 270e224dd61f912154a086ed00a9e35dd4caf522955086db5ae5bd27aa6ce9ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ml_model_manager-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ceff69b061052f4fd5508b656cc9838c0489f5cc0db1bb5152878640bb2e946
MD5 060b95fc248fdb8350670318a2a9b0c0
BLAKE2b-256 5bc15caf1287940a092b584fcc09974a603bfd43636112130882da609d02ec79

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