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.1
Source code
- Download Version 0.1 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 ❌ | - |
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.1 - 2023-06-29
Added
- scikit-learn linear models support
Export
classImport
class
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.