https://github.com/previsionio/prevision-onnx-templates
https://github.com/previsionio/prevision-onnx-templates
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/previsionio/prevision-onnx-templates
- Owner: previsionio
- License: gpl-3.0
- Created: 2021-10-04T08:06:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-14T10:23:33.000Z (over 4 years ago)
- Last Synced: 2025-03-22T12:48:52.718Z (about 1 year ago)
- Language: Python
- Size: 67.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prevision-onnx-templates
This repo provide code to understand and build onnx models for use in the [Prevision.io Platform](https://cloud.prevision.io).
A complete doc for using onnx model in [Prevision.io Platform](https://cloud.prevision.io) is available [here](https://previsionio.readthedocs.io/fr/latest/studio/experiments/external-model.html)
## Setup
Clone this repo and open the prevision-onnx-templates folder :
```sh
git clone https://github.com/previsionio/prevision-onnx-templates.git
cd prevision-onnx-templates
```
If not done, create a virtualenv
```sh
python -m venv env
```
And install the requirements
```
source env/bin/activate
pip install -r requirements.txt
```
### Using the SDK
If you want to use the [Prevision SDK](https://prevision-python.readthedocs.io/en/latest/source/getting_started.html) yoy may setup an `.env` file with the following fields :
```
DOMAIN=https://cloud.prevision.io
PIO_MASTER_TOKEN=
```
( see [the API doc to get your master token](https://previsionio.readthedocs.io/fr/latest/API/using.html))
## Usage
Note : a small subset of a fraud transaction dataset is provided in the `data` folder.
You can use sktoonnx.py for a basic sklearn classifier exportation to onnx :
```sh
python sktoonnx.py
```
The scripts build a ( very ) basic classifier and export it to onnx model. You can then use the content of `data/assets` folder into your [Prevision Account](https://cloud.prevision.io). Then see [the documentation for importing your own model](https://previsionio.readthedocs.io/fr/latest/studio/experiments/external-model.html)
### Using the SDK
You can use ( and inspect ) the `sdkimport.py` script to export your models and pipeline programmatically. This script uses several basic sklearn pipeline ( feature engineering + modelisation) , converts them to onnx and create an experiment to benchmark them altogether inside the same experiment into your [prevision account](https://cloud.prevision.io)
**Warning : this scripts uses ressources generated from the previous one so be sure to launch it before
```sh
python sktoonnx.py
python sdkimport.py
```