Making Predictions

Once your Machine Learning model is built, you can use to automatically predict outcomes. With Obviously AI's API you can make a call with new values and get a prediction result back. You can then automate these predictions and relevant actions associated with them (e.g. If prediction is this, then do this action).

1. Make a ML model

First, you need to make a Machine Learning model using Obviously AI. For this, log into your account, upload a dataset and pick the column you want to predict. This will kick off the automatic process of Obviously AI building a Machine Learning model for you. To learn more, check out this video on how to build a Machine Learning 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. This call we're about to make, requires us to pass all the attributes of a new prediction we're trying to make and it will return a JSON with predicted probabilities back.

import requests

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

data = {
  "features" : {
    "<column_A>": value_A,
    "<column_B>": value_B,
    "<column_C>": value_C,
    "<column_D>": value_C,
    "<column_E>": value_E,
    "<column_F>": value_F,
  },
  "id": "<report_id>"
}

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

response.json()