Making Predictions

On Obviously AI 's Time Series models

Time Series is a special class of Machine Learning algorithms which is used to predict changes to a variable over time. Some of the Widely used applications of time series are:

  • Predicting the Sales of commodities
  • Getting estimate of Demand and Inventory
  • Estimating the foot traffic in a store
  • Forecasting Weather conditions

To start making Time Series predictions with Obviously AI's APIs, follow the steps below.

1. Make a Time Series model

First, you need to make a Time Series model using Obviously AI. For this, log into your account, upload a Time Series dataset and pick the column you want to predict. This will kick off the automatic process of Obviously AI building a Time Series model for you. To learn more, check out this video on how to build a Time Series model with Obviously AI below.

2. Call the API

Once you create a prediction report on Obviously AI all you need is your report id and the Access Token. The forecast period is 10 by default but you can change it as per your requirement.

import requests

head = {
  'Authorization' : 'ApiKey <api_key>'
}

data = {
 "report_id": "<report_id>",
 "forecast_period": 10
}

response = requests.post(
  'https://api.obviously.ai/user/uni-timeseries', 
  json=data, 
  headers=head
)

response.json()

In the endpoint above simply replace the api_key with your unique API key and enter the report_id. This will return a JSON object containing the forecasts that will look like something below.

{'data': [
    {'Date_Time': '1972-10-01', 'sales': 6876.1356010895},
  {'Date_Time': '1972-11-01', 'sales': 10115.5220625219},
  {'Date_Time': '1972-12-01', 'sales': 12931.4356651634},
  {'Date_Time': '1973-01-01', 'sales': 4074.7060325474},
  {'Date_Time': '1973-02-01', 'sales': 3544.489436016},
  {'Date_Time': '1973-03-01', 'sales': 4476.3787634534},
  {'Date_Time': '1973-04-01', 'sales': 4723.5639921535},
  {'Date_Time': '1973-05-01', 'sales': 4711.3777711188},
  {'Date_Time': '1973-06-01', 'sales': 5155.2814323774},
  {'Date_Time': '1973-07-01', 'sales': 4496.8744183687}]}