[Prevision.io Python SDK]  Introduction & setup

by Zina Rezgui


Are you a passionate Python Data Scientist looking for the RIGHT way to build production-ready and fully monitored AI models using your real-world business data?

Grab your drink and Enjoy this blog post series dedicated to showcasing Prevision.io’s AI management platform and its Python SDK.  For this exercise we will focus on forecasting electricity consumption 🥳! 


At the end of this journey A project of electricity forecast powered by deployed and fully monitored models will be added to your realized projects list!

If you want to find the other articles of this series: 

Part 1 - Introduction & Setup
- Part 2 - Basic Data Ingestion
Part 3 - Experiment tracking using AutoML
Part 4 - Model Deployment
Part 5 - Pipelines Overview
- Part 6 - Apps Deployment
Part 7 - Model Lifecycle & Conclusion


Let The journey Begin


Note: If you are a data scientist more comfortable with R, no worries we’ve got you covered in another blog post series available on our website😇! For Python data scientists, because of iterative development of the product, Python functions used in this series are designed to work with Prevision.io ’s versions going from 11.3.1 to 11.3.4.


Prevision.io Solution: Experiment, Deploy, Monitor


Prevision.io is a complete AI management platform meant to help you build, deploy and monitor efficient AI models without any hassle.

The whole goal of the offering is to provide you with an efficient and well-prepared framework that takes away all the storage, analysis, modeling, deployment and monitoring complexity. 

Prevision.io is user-friendly and offers an online web version with an intuitive UI which makes it easy to start taking advantage of all the features and the power of the platform. Moreover, most tasks done within the UI can be achieved by coding within our SDKs which may be convenient for the most advanced users. 


What Are We Doing Today?

For today’s first blog post, we’ll start by setting up the Prevision.io Python SDK in order to enjoy interacting with Prevision.io APIs directly from a python environment. 

First things first, start by heading over to this link and create a free account. You’ll need it later! 


Step1. Pre-requisites:

The Prevision.io Python SDK has some dependencies that need to be installed prior to installing the SDK. 


Before Starting: Free Trial Account Creation


As of today, these requirements can be found here [Up to date dependencies]. They can be installed with a simple pip install within your Python environment.


Step2. Get the package:

This step can be achieved by three methods:

  1. Using Prevision.io’s notebooks: It is actually the easiest way to use the package without worrying about the package installation. The only action to take is to go into your Prevision.io instance and launch a python notebook. 



                Account Created: Launch & Start Using Python Notebooks 🚀 


  1. Using Prevision.io in your own environment:

    1. You can get the latest version from Prevision.io’s repository, available on this [Link] and follow simply the instructions mentioned in the readme or simply type in your favourite console:


git clone https://github.com/previsionio/prevision-python
cd prevision-python
python setup.py install


          Please note that:

  • Git should be installed on your computer / server

  • A working internet connection is needed to retrieve sources

  • The current version number is 11.3.1, but that will change over time

  1. You can simply type pip install previsionio and run the command. 


Once the Prevision.io notebook is run (for method1) or the package is installed(for both choices of method 2), you can import the library and print the version number to confirm it was installed successfully. By default, the latest version (11.3.1):


In [1]: import previsionio as pio
In [2]: pio.__version__

Out[2]: 'v11.3.1'


Step 3.  Set Up your client

Prevision.io’s SDK client uses a specific master token to authenticate with the instance’s server and allows you to perform various requests. To get your master token, log in the online interface of your instance, navigate to the admin page and copy the token.



Access Your Admin Page 


Once done, don’t forget to either set the token and the instance name as environment variables by specifying PREVISION_URL and PREVISION_MASTER_TOKEN ,or at the beginning of your script:


import previsionio as pio

# The client is initialized with your master token and the url of the prevision.io server
# (or local installation, if applicable)
url = "https://<your instance>.prevision.io"
token = "<your token>"
pio.client.init_client(url, token)


What’s coming next?

Now that everything is installed and connected, let the fun begin by sending some data from your Python environment to the Prevision.io’ platform  🧐. 




Prevision.io brings powerful AI management capabilities to data science users so more AI projects make it into production and stay in production. Our purpose-built AI Management platform was designed by data scientists for data scientists and citizen data scientists to scale their value, domain expertise, and impact. The platform manages the hidden complexities and burdensome tasks that get in the way of realizing the tremendous productivity and performance gains AI can deliver across your business.

If you want to find the other articles of this series: 

- Part 1 - Introduction & Setup
- Part 2 - Basic Data Ingestion
- Part 3 - Experiment tracking using AutoML
- Part 4 - Model Deployment
- Part 5 - Pipelines Overview
- Part 6 - Apps Deployment
- Part 7 - Model Lifecycle & Conclusion


Suivez-nous sur Twitter ! Suivez-nous sur Linkedin ! Suivez-nous sur Instagram !