Skip to main content

Unified AI/ML toolkit providing a consistent API for accessing 205 models and tasks from scikit-learn, PyTorch, TensorFlow, and other popular libraries.

Project description

AI_MK_Toolkit

A well-tested Python package providing a unified API for accessing 205 models and tasks from popular open-source machine learning, deep learning, NLP, reinforcement learning, and computer vision libraries. All entries are callable via intuitive dot-path imports like ai_mk_toolkit.ml.RandomForest().

This package is a unified interface wrapper built on top of open-source libraries. It does not reimplement algorithms but provides convenient access to widely used models from leading frameworks.

Requires Python >= 3.10. Tested on Windows, Linux, and macOS.

๐Ÿš€ Why This Project?

Working across scikit-learn, PyTorch, TensorFlow, and dozens of other libraries means learning different APIs, managing disparate imports, and juggling installation quirks. AI_MK_Toolkit gives you one consistent interface so you can focus on experiments rather than boilerplate.

โœจ Key Features

  • Unified API: Single interface for accessing models across frameworks (scikit-learn, PyTorch, TensorFlow)
  • Lazy Loading: Heavy optional dependencies loaded only when used
  • 205 Entries: Pre-configured access to 51 ML, 67 DL, 54 NLP, 19 RL models and 14 CV task APIs from trusted libraries
  • Consistent Interface: Provides the same API patterns whether you use PyTorch or TensorFlow implementations under the hood
  • Designed for Production Use: Type hints, error handling, PEP 561 compliance (py.typed)
  • License Aware: Documents the licenses of all underlying libraries so users can make informed decisions

๐Ÿ“– About This Project

What it is: ai-mk-toolkit is a unified Python interface that wraps popular, well-tested machine learning libraries. It lets you access 205 models and tasks through a consistent, intuitive API.

What it is NOT: This package does NOT reimplement algorithms from scikit-learn, PyTorch, TensorFlow, or any other library. It solely provides a convenient interface layer for accessing these libraries.

Design Philosophy:

  • Wrap battle-tested libraries (scikit-learn, PyTorch, TensorFlow, etc.) โ€” never reimplement
  • Provide a consistent API across different frameworks
  • Let users install only what they need (modular optional dependencies)
  • Respect and document all open-source licenses
  • Be transparent about authorship and attribution

๐Ÿ“ฆ Installation

Base Install

Installs core dependencies: numpy, scikit-learn, pyyaml, joblib, torch, torchvision, tensorflow.

pip install ai-mk-toolkit

With Additional Deep Learning Libraries

pip install ai-mk-toolkit[dl]            # Adds timm, ultralytics

With NLP & Transformers

pip install ai-mk-toolkit[nlp]           # Adds transformers, nltk, spacy, gensim

With Reinforcement Learning

pip install ai-mk-toolkit[rl]            # Adds stable-baselines3, sb3-contrib

Everything

pip install ai-mk-toolkit[full]          # All optional extras

๐ŸŽฏ Quick Start

Classical Machine Learning

from ai_mk_toolkit import ml

# 51 models: regression, classification, clustering, dimensionality reduction
regressor = ml.LinearRegression()
regressor.fit(X_train, y_train)
predictions = regressor.predict(X_test)

# Or by name
xgb = ml.get_model("XGBoost", n_estimators=50)
pca = ml.PCA(n_components=10)
svm = ml.SVC(kernel="rbf")

Deep Learning

from ai_mk_toolkit import dl

resnet = dl.ResNet50(backend="torch", pretrained=True)  # CNN (PyTorch)
yolo = dl.YOLOv8()                                      # Object Detection (ultralytics)
lstm = dl.LSTM(backend="torch", units=128)               # Sequence model

Natural Language Processing

from ai_mk_toolkit import nlp

# Classical NLP (NLTK / spaCy wrappers)
tokenizer = nlp.Tokenizer()

# Encoder model โ€” suited for embeddings, classification, NER
bert = nlp.BERT()

# Causal / generative LLM โ€” suited for text generation
llama3 = nlp.Llama3()

Reinforcement Learning

Tabular RL algorithms (QLearning, SARSA, ExpectedSARSA, MonteCarlo) are lightweight original implementations included in this package. Deep RL classes (DQN, PPO, A2C, SAC, etc.) are wrappers around stable-baselines3.

from ai_mk_toolkit import rl

# Tabular RL (included implementation)
ql = rl.QLearning(n_states=16, n_actions=4)

# Deep RL (stable-baselines3 wrapper, requires [rl] extra)
dqn = rl.DQN(policy="MlpPolicy", env=env)
sarsa = rl.SARSA(n_states=16, n_actions=4)

Computer Vision Tasks

The cv module provides task-oriented APIs that route to appropriate underlying models (e.g., ResNet, YOLO). These are task interfaces, not standalone model implementations.

from ai_mk_toolkit import cv

image_clf = cv.ImageClassification()   # Routes to ResNet50
detector = cv.ObjectDetection()        # Routes to YOLOv8
segmenter = cv.ImageSegmentation()     # Routes to Mask R-CNN

๐Ÿ“Š Model & Task Catalog

Note: The counts below include both unique model wrappers and task-level APIs. Some entries (e.g., Computer Vision tasks) are convenience interfaces that route to underlying models listed in other categories.

๐Ÿ“ˆ Machine Learning โ€” 51 model wrappers (scikit-learn, XGBoost, LightGBM, CatBoost, UMAP): LinearRegression, Ridge, Lasso, ElasticNet, SVC, LogisticRegression, RandomForest, DecisionTree, XGBoost, LightGBM, CatBoost, KNN, PCA, TSNE, UMAP, and 36 more

๐Ÿง  Deep Learning โ€” 67 model wrappers (36 CNNs + 12 detectors + 8 sequence + 11 GANs): ResNet18/34/50/101/152, VGG16/19, MobileNetV2/V3, EfficientNetB0-B7, YOLOv5/v8/v9/v10, LSTM, GRU, GAN, StyleGAN, CycleGAN, WGAN, and more

๐Ÿค– NLP โ€” 54 entries (12 classical tools + 30 transformer models + 12 task pipelines): BERT (encoder), GPT-2 (causal), Llama 3 (causal), Mistral, T5 (seq2seq), Word2Vec, FastText, TFIDF, TextClassification, Summarization, and more

๐ŸŽฎ Reinforcement Learning โ€” 19 entries (5 tabular + 14 deep RL): QLearning, SARSA, ExpectedSARSA, MonteCarlo, TDLearning (tabular โ€” included implementations) + DQN, DoubleDQN, PPO, A2C, SAC, TD3, DDPG, TRPO (deep RL โ€” stable-baselines3 wrappers)

๐Ÿ‘๏ธ Computer Vision โ€” 14 task APIs (routing interfaces to DL models above): ImageClassification, ObjectDetection, ImageSegmentation, PoseEstimation, OCR, FaceRecognition, ImageCaptioning, ImageGeneration, DepthEstimation, and more

๐Ÿ—๏ธ Architecture

ai_mk_toolkit/
โ”œโ”€โ”€ ml/              # 51 scikit-learn / XGBoost / LightGBM / CatBoost wrappers
โ”œโ”€โ”€ dl/              # Deep learning model wrappers (PyTorch / TensorFlow)
โ”œโ”€โ”€ nlp/             # NLP model wrappers (NLTK, spaCy, Transformers)
โ”œโ”€โ”€ rl/              # Tabular RL + stable-baselines3 wrappers
โ”œโ”€โ”€ cv/              # Task-oriented computer vision APIs
โ”œโ”€โ”€ core/            # Device detection, caching, logging, serialization
โ”œโ”€โ”€ backends/        # PyTorch / TensorFlow / sklearn backend abstraction
โ”œโ”€โ”€ automl/          # Hyperparameter search and model comparison
โ”œโ”€โ”€ datasets/        # Built-in dataset loaders
โ”œโ”€โ”€ preprocessing/   # Data transformation utilities
โ”œโ”€โ”€ metrics/         # Evaluation metrics (classification, regression, clustering)
โ”œโ”€โ”€ explainability/  # Feature importance, SHAP, LIME wrappers
โ”œโ”€โ”€ visualization/   # Matplotlib-based plotting helpers
โ”œโ”€โ”€ deployment/      # Model export (ONNX, TorchScript, SavedModel, joblib)
โ””โ”€โ”€ plugins/         # User-extensible model/dataset/metric registration

๐Ÿ”ง Advanced Usage

Unified Classifiers (scikit-learn backed)

from ai_mk_toolkit import UnifiedClassifier

clf = UnifiedClassifier(model="svc", kernel="rbf")
clf.fit(X_train, y_train)
print(clf.backend_name)

Deep Learning with Backend Selection

from ai_mk_toolkit import UnifiedModel

model = UnifiedModel(backend="pytorch")
model.add_dense(128, activation="relu")
model.compile(task="classification")
model.fit(X_train, y_train, epochs=10)
predictions = model.predict(X_test)

โœ… Quality Assurance

  • Static Analysis: Ruff is used to continuously check for unused imports (F401) and unused variables (F841). Current status: all checks passing.
  • Comprehensive Testing: 89 tests passing (framework-specific tests included). Full coverage of core functionality.
  • Build & Packaging: Passes PyPI validation via twine. Builds successfully for both sdist and wheel distributions.
  • Wrapper Architecture: No algorithm reimplementations. Pure interface layer over open-source libraries.
  • Dependencies: Core dependencies auto-installed; optional extras available for specialized domains.

๐Ÿ“‹ Testing

pytest                    # All tests
pytest -v                 # Verbose
pytest tests/test_classical_models.py  # Specific test

โš–๏ธ License & Attribution

AI_MK_Toolkit itself is released under the MIT License โ€” see LICENSE.

The underlying libraries have their own licenses:

Library License
numpy, scikit-learn BSD
torch, torchvision BSD
tensorflow Apache 2.0
transformers, sentence-transformers Apache 2.0
xgboost, lightgbm, catboost Apache 2.0
nltk, spacy Apache 2.0
gensim LGPL-2.1+
ultralytics AGPL-3.0
stable-baselines3, sb3-contrib MIT
timm Apache 2.0
pyyaml MIT
joblib BSD

Important: Some optional dependencies (e.g., ultralytics under AGPL-3.0, gensim under LGPL-2.1+) have copyleft license terms. Users are responsible for complying with the licenses of the optional dependencies they choose to install. If your project requires only permissive licenses, avoid installing the [cv] and [nlp] extras, or review individual package licenses before use.

๐Ÿ™ Acknowledgments

This package is built on top of the following open-source libraries. We are grateful for their contributions to the ML community.

Core Dependencies (always installed):

  • scikit-learn (BSD-3-Clause) โ€” Classical ML algorithms
  • NumPy (BSD) โ€” Numerical computing foundation
  • PyTorch (BSD) โ€” Deep learning framework
  • torchvision (BSD) โ€” Pre-trained computer vision models
  • TensorFlow/Keras (Apache 2.0) โ€” Deep learning framework
  • PyYAML (MIT) โ€” Configuration management
  • joblib (BSD) โ€” Serialization and parallelism

Optional Deep Learning (install via [dl] extra):

  • timm (Apache 2.0) โ€” PyTorch image models library
  • Ultralytics (โš ๏ธ AGPL-3.0) โ€” YOLO object detection models

Optional ML Boosting (install via [ml_boosting] extra):

  • XGBoost (Apache 2.0) โ€” Gradient boosting
  • LightGBM (MIT) โ€” Fast gradient boosting
  • CatBoost (Apache 2.0) โ€” Categorical gradient boosting
  • UMAP (BSD-3-Clause) โ€” Dimensionality reduction

Optional NLP (install via [nlp] extra):

  • Transformers (Apache 2.0) โ€” HuggingFace transformer models (BERT, GPT, Llama, Mistral, etc.)
  • NLTK (Apache 2.0) โ€” Classical NLP tools
  • spaCy (MIT) โ€” Industrial-strength NLP
  • Gensim (โš ๏ธ LGPL-2.1+) โ€” Topic modeling and embeddings
  • sentence-transformers (Apache 2.0) โ€” Semantic embeddings

Optional Reinforcement Learning (install via [rl] extra):

  • Stable Baselines 3 (MIT) โ€” RL algorithms (DQN, PPO, A2C, etc.)
  • sb3-contrib (MIT) โ€” Additional RL algorithms

๐Ÿ“ Contributing

โœ… What IS Acceptable

  1. Wrapping existing libraries โ€” Creating unified interfaces to access models from sklearn, PyTorch, TensorFlow, etc.
  2. Adding new model aliases โ€” Mapping additional models from existing libraries
  3. Improving documentation โ€” Better examples, guides, and explanations
  4. Fixing bugs โ€” Improving robustness and error handling
  5. Performance optimization โ€” Making wrappers more efficient
  6. Enhanced testing โ€” Expanding test coverage

โŒ What IS NOT Acceptable

  1. Copying source code from TensorFlow, PyTorch, scikit-learn, or any other library
  2. Reimplementing algorithms that already exist in well-maintained libraries
  3. Claiming ownership of algorithms from other libraries
  4. Removing or obscuring attribution to underlying libraries

Dependency Policy

Core Dependencies (installed by default): numpy, scikit-learn, pyyaml, joblib, torch, torchvision, tensorflow. Any change to core dependencies must be discussed before merging.

Optional Extras: Use pip install ai-mk-toolkit[extra_name] pattern. Group related libraries together. Keep extras for specialized or heavy libraries not needed by every user.

License Compliance

Before adding a new library as a dependency:

  • Check the license โ€” Preferred: MIT, BSD, Apache 2.0. Acceptable: LGPL (document clearly). Avoid: GPL (incompatible with MIT).
  • Document in README โ€” Add library name and license to the Acknowledgments section.
  • Update pyproject.toml โ€” Add version constraints and place in appropriate optional-dependencies group.

Testing Guidelines

  • Write tests that verify wrapper behavior, not algorithm correctness
  • โŒ Don't test that scikit-learn's SVM actually works correctly
  • โœ… Do test that our wrapper instantiates and calls SVM correctly

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

ai_mk_toolkit-8.0.0.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

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

ai_mk_toolkit-8.0.0-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_mk_toolkit-8.0.0.tar.gz.

File metadata

  • Download URL: ai_mk_toolkit-8.0.0.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for ai_mk_toolkit-8.0.0.tar.gz
Algorithm Hash digest
SHA256 088e3f6b40642ae542f6370fe8428e58a1fdbdd579703f78a3e60de7f5f4e20f
MD5 be78866da80ca8a3856836d2c2aa148f
BLAKE2b-256 f9dd7ff8f790d7b85546a1d843561d20f4d9e0e74ee4611ee8148bd044ef435c

See more details on using hashes here.

File details

Details for the file ai_mk_toolkit-8.0.0-py3-none-any.whl.

File metadata

  • Download URL: ai_mk_toolkit-8.0.0-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for ai_mk_toolkit-8.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83afe29de3130c4d996d8109b6d92932a499af9a0b537dabf9c949d4ce04cb44
MD5 ae9e760cc2e18ddf33141fa21d6069b1
BLAKE2b-256 fc3e82fe33773ed0a73f770670c6008904c9792e044f04c5a237b5b4534807fb

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