From 3143424b18f019dc271e11a5879970e2cdc7f493 Mon Sep 17 00:00:00 2001 From: Jason Jafari Date: Sun, 16 Jun 2024 13:52:20 -0400 Subject: [PATCH] chore: bump version to 1.0.22 --- DOCS.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- setup.py | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/DOCS.md b/DOCS.md index 24b9333..ad8f236 100644 --- a/DOCS.md +++ b/DOCS.md @@ -7,3 +7,52 @@ While numerous tools are available for training machine learning models, many li **[mlModelSaver](https://github.com/smartdev-ca/mlModelSaver)** fills this gap, offering an intuitive way to save machine learning models and transformers. It facilitates seamless integration with frameworks like FastAPI ([Examples](https://github.com/jafarijason/ml_models_deployments)), Flask, and Django, enabling easy deployment and serving of models in production environments. Empower your machine learning workflow with **mlModelSaver** – the easy and efficient tool for model management. +## Installation + +You can install **mlModelSaver** via pip: + +```bash +pip install mlModelSaver +``` + + +# mlModelSaver Example: Simple Linear Regression + +In this example, we demonstrate how to use **mlModelSaver** to export a simple linear regression model based on a notebook from [ml_models_deployments](https://github.com/jafarijason/ml_models_deployments/blob/master/notebooks/001.ipynb). + +### Example Description + +This example builds a simple linear regression model to predict sales based on temperature, advertising, and discount factors. Once the model is fitted and satisfactory, **mlModelSaver** allows you to easily save and deploy the model for use in production environments. + +### Example Code - notebook available [here](https://github.com/jafarijason/ml_models_deployments/blob/master/notebooks/001.ipynb) + + +```python +def add_constant_columnTransformer(df): + # example transformer + df_with_const = df.copy() + df_with_const.insert(0, 'const', 1) + return df_with_const + +# Export the model using MlModelSaver +loadedModel = mlModelSaverInstance.exportModel( + simpleLinearRegressionFittedModel, # the models is fitted and ready for usage + { + "modelName": "modelPredictSaleByTemperatureAdvertisingDiscountFit", + "description": "Example model predicting sales based on temperature, advertising, and discount.", + "modelType": "sm.OLS", # Example model type (replace with actual type) + "inputs": [ + {"name": "Temperature", "type": "float"}, + {"name": "Advertising", "type": "float"}, + {"name": "Discount", "type": "float"} + ], + "transformer": add_constant_columnTransformer, # Use your transformation function here + "outputs": [ + { + "name": "Sales", + "type": "float" + } + ] + } +) +``` diff --git a/package.json b/package.json index dc7c583..4119eea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mlModelSaver", - "version": "1.0.21", + "version": "1.0.22", "description": "Make life easier for save and serving ml models", "main": "index.js", "repository": "git@github.com:smartdev-ca/mlModelSaver.git", diff --git a/setup.py b/setup.py index 57d8d70..ab7c8ea 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='mlModelSaver', - version='1.0.21', + version='1.0.22', packages=find_packages(), description='Make life easier for saving and serving ML models', long_description=open('DOCS.md').read(), # Assumes you have a README.md file