If you are here, you are most likely a Data Scientist using R as your primary development language. If you are more on the Python side, no worries we’ve got you covered in another blog post series available on our website.
This specific blog post series is aimed at showcasing Prevision.io R SDK capabilities involved in the creation of a WEB application powered by AI models that are production-ready and fully monitored. Because we are sick of always having tutorials that rely on the titanic data set, we will focus here on forecasting electricity consumption (we will use France consumption in this example). All output will be displayed in an R Shiny Dashboard.
Sneak peek of an application put on top of monitored predictions
Because of iterative development of the product, R functions used in this series are designed to work with Prevision.io’s 11.3.3 version.
Machine Learning and data science have been a growing trend that almost every organization is exploring. This dynamic duo is an amazing opportunity to incorporate the incredible amount of data we gather to solve everyday problems. At the same time, whether it’s your job or because you are just an enthusiast, you might have noticed that machine learning projects involve repetition of the same steps over and over again: finding datasets, preprocessing them, extracting relevant features from them, rewriting the same wrapper around a data science lib model to fit in your project, deploying the packaged model, monitoring its usage and sometimes even creating a WEB application on top of it!
As the technology developed, the idea of simplifying and automating some of these processes grew as well. This is why today, the concept of an AI management platform is spreading like wildfire.
Indeed, what if instead of wasting time on exhausting and resource-consuming small steps you could forget about these repetitive tasks, generate accurate models easily and then deploy them into production without any hassle? Through this series of blog posts, we will show you how the Prevision.io platform can accomplish these types of results for your company.
Prevision.io is a complete AI management platform meant to help you build, deploy and monitor efficient AI models without any hassle (we do our best here 🥳).
The whole goal of the tool is to give you 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 which may be convenient for the most advanced users. Here, we will focus on the R SDK. Let’s start by setting it up and then connecting it to Prevision.io.
The Prevision.io R SDK has some dependencies that need to be installed prior to installing the SDK. As of today, these requirements are:
They can be installed with a simple install.packages() call within your R environment. Up to date dependencies are listed here.
Please note that the documentation associated with the R SDK is available here.
This method is actually the easiest one and doesn’t require you to take any action other than going into your Prevision.io’s instance and launching an R notebook :
Notebook not started
Ready to play notebooks
In the notebook, type library(previsionio), run the cell and you are good to go 🚀
A nice welcome message
If you want to use the SDK from an environment outside of Prevision.io’s notebook, such as your prefered local IDE (RStudio, Visual Studio Code, etc.) you need to install the package locally.
To do so, go to our public git repository located at https://github.com/previsionio/prevision-r and follow the instructions in the readme or simply type in your favorite console:
git clone https://bitbucket.org/previsionio/previsionio-r
R CMD build previsionio-r
R CMD INSTALL previsionio_<SDK_VERSION>.tar.gz
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.3, but that will change over time 🧐
Then type library(previsionio), run it, and you should have a nice welcome message 💪
For somebody who doesn't want to get too technical, but still wants to use the Prevision.io’s SDK in its own environment, you can just type install.packages(“previsionio”) and run this command. This will retrieve from the CRAN the latest stable version of the SDK. Please note that in case of recent release, there can be a version mismatch between your instance and the CRAN version. If changes are significant for you, please refer to method #2 above.
Finally, execute the library(previsionio) command and then you can start playing with the SDK 🤯
In Prevision.io, users are being identified with something called a “master token”. The master token is a personal identifier that can be retrieved from Prevision.io’s UI. Once you have a Prevision.io account and are logged into your instance, click on the top right part of the screen displaying your initials (First Name initial/Last Name initial) then go to “Administration and API Key”.
Administration & API key available in the top right-menu
Then you can get your master token (or generate it before retrieving it if the cell is empty).
Master token retrieval in Prevision.io’s UI
Make sure to copy it as it will be needed in your R script to authenticate yourself.
If, by any chance, you get this token compromised, feel free to regenerate it (and update scripts using it 😇).
Whenever you want your code to access your Prevision.io instance, you need to do a small initialization step at the very beginning to ensure you are properly connected to the platform.
After importing the SDK package, you simply need to create a new client by passing in your master token and the address of your instance to the SDK method:
pio_url = "https://<INSTANCE_NAME>.prevision.io"
pio_tkn = "<TOKEN>"
Note: remember to replace the `<TOKEN>` variable with your own master token and the `<INSTANCE_NAME>` with the name of your own Prevision.io instance.
Now that everything is installed and connected, we are free to move on to the next step: sending some data from your R environnement to the Prevision.io’s 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.
- 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