Predictive Analytics Tutorial

Adrien Auclair
Serenytics

--

In Serenytics, there are two ways to achieve predictive analytics:

  • click: create a new task that will compute a linear regression on your data. This options is perfect if you have a time serie and you want to use a linear regression to predict the future values of a metric.
  • code: write your own predictive model in Python. This option lets you create more advanced models.

This tutorial will guide you through both options.

Create a linear regression with a simple task

In the automation menu, create a new Task:

Then choose Linear regression in the Predictive section:

And configure the task:

In this configuration, the output storage is a table within the Serenytics internal datawarehouse. You need to create such a table to be able to run this predictive task. To do that, open the Data menu, and create a new data source of type Storage in the Serenytics Datawarehouse section.

The next step is to actually execute the predictive algorithm. In the Execution tab, click on Run now:

Now, you can use the predictive data in the output storage in a dashboard:

All the above steps are very straightforward and let you add predictive analytics to your dashboards in a few clicks.

Adding predictive values to your KPI

Let’s say you want to build this KPI widget:

You need to access the prediction at a particular day (e.g. end of current year in the above example). To do that, you need to configure the previous steps with day as time granularity. In the resulting storage, create the formula:

last_value_if([linear_regression], [Date], [Date] in year(0))

This will return the value of the linear regression for the last day in the current year (i.e. year(0)). You could also use month(0)for the current month,quarter(0) for the current quarter, year(1) for next year…

See here for the last_value_if documentation. See this tutorial to create your own KPI widget like the above example.

Predictive analytics with Python in Serenytics

In case you want to use a finer algorithm than a simple linear regression, you can write your own predictive algorithm in Python and run it in Serenytics.

To get you started, here is a script to compute a simple linear regression (similar to the one encapsulated in the above task). You can copy it in a Python script in Serenytics. All you have to do is change the options at the beginning of the script to make it work for your data.

With these two options, you can now add predictive analytics to your dashboards in a few clicks, or dig deeper in the predictive algorithms in Python.

--

--

Adrien Auclair
Serenytics

Serenytics Founder - Planorama Founder- PhD in Computer Vision - Entrepreneur & coder