Transportation of ML models
Project description
Table of contents
- Overview
- Installation
- Usage
- Issues & Bug Reports
- Todo
- Contribution
- Authors
- License
- Show Your Support
- Changelog
- Code of Conduct
Overview
Pymilo is an open source Python package that provides a simple, efficient, and safe way for users to export pre-trained machine learning models in a transparent way. By this, the exported model can be used in other environments, transferred across different platforms, and shared with others. Pymilo allows the users to export the models that are trained using popular Python libraries like scikit-learn, and then use them in deployment environments, or share them without exposing the underlying code or dependencies. The transparency of the exported models ensures reliability and safety for the end users, as it eliminates the risks of binary or pickle formats.
| PyPI Counter |
|
| Github Stars |
|
| Branch | main | dev |
| CI |
|
|
Installation
PyPI
- Check Python Packaging User Guide
- Run
pip install pymilo==0.2
Source code
- Download Version 0.2 or Latest Source
- Run
pip install .
Usage
Simple Linear Model Preparation
>>> from sklearn import datasets
>>> from pymilo import Export, Import
>>> from sklearn.linear_model import LinearRegression
>>> import os
>>> X, Y = datasets.load_diabetes(return_X_y=True)
>>> threshold = 20
>>> X_train, X_test = X[:-threshold], X[-threshold:]
>>> Y_train, Y_test = Y[:-threshold], Y[-threshold:]
>>> model = LinearRegression()
>>> #### Train the model using the training sets
>>> model.fit(X_train, Y_train)
Save Model
>>> #### Export the fitted model to a transparent json file
>>> exported_model = Export(model)
>>> PATH_TO_JSON_FILE = os.path.join(os.getcwd(),"test.json")
>>> exported_model.save(PATH_TO_JSON_FILE)
Load Model
>>> #### Import the pymilo-exported model and get a real scikit model
>>> imported_model = Import(PATH_TO_JSON_FILE)
Get the associated Scikit model
>>> imported_sklearn_model = imported_model.to_model()
Note: imported_sklearn_model has the exact same functionality as the model object earlier.
Supported ML Models
| scikit-learn | PyTorch |
|---|---|
| Linear Models ✅ | - |
| Neural networks ✅ | - |
| Clustering ❌ | - |
| Trees ❌ | - |
| Ensemble Models ❌ | - |
| Details are available in Supported Models. |
Issues & bug reports
Just fill an issue and describe it. We'll check it ASAP! or send an email to info@openscilab.com.
- Please complete the issue template
You can also join our discord server
Show Your Support
Star this repo
Give a ⭐️ if this project helped you!
Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Unreleased
0.2 - 2023-08-02
Added
- scikit-learn neural network models
MLP RegressormodelMLP ClassifiermodelBernoulliRBNmodelSGDOptimizertransporterRandomState(MT19937)transporterAdamoptimizertransporter- Neural Network chain
- Neural Network exceptions
ndarray_to_listmethod inGeneralDataStructureTransporterlist_to_ndarraymethod inGeneralDataStructureTransporterneural_network_chain.pychain
Changed
GeneralDataStructureTransporter updatedLabelBinerizerTransporter updatedlinear modelchain updated- GeneralDataStructure transporter enhanced
- LabelBinerizer transporter updated
- transporters' chain router added to
pymilo func - NeuralNetwork params initialized in
pymilo_param pymilo_testupdated to support multiple modelslinear_model_chainrefactored
0.1 - 2023-06-29
Added
- scikit-learn linear models support
ExportclassImportclass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymilo-0.2.tar.gz.
File metadata
- Download URL: pymilo-0.2.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f8e00952b75d27b7b71c13168e1dac7b5a088ac1cdf56a27c58a82751f90656
|
|
| MD5 |
0c06084b36ee9c4744a3c44fb39f2275
|
|
| BLAKE2b-256 |
73620bf06a1987600e4a079e6b57fe50f61f7997ebaffde41a46bceb0d5eb4be
|
File details
Details for the file pymilo-0.2-py3-none-any.whl.
File metadata
- Download URL: pymilo-0.2-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc16dca74c59d6f4688347ae63b77a0da93e8f1672a1c43f42b4914af989bab4
|
|
| MD5 |
ff24cb61e8f56c04aba9ce720899cff4
|
|
| BLAKE2b-256 |
2dd0d54135a026e4731588f8d642d4ae76684c9c6c9f7e44506a56923c4d346b
|