1. This article details how to make predictions via the API. First you would need to ensure the following before diving into making predictions with API.

    1. Make sure that you are on Pro plan because it supports API access

    2. Upload your data and generate a prediction report to access information such as feature weights, tech specs, etc. and make predictions on models already built on the platform

    3. Ensure you are the admin of your Obviously AI account to access, manage and implement our APIs

    4. Access API key - navigate to the settings page, then Integration & API, click on show to get the API key

  2. Once you create your prediction report have your API key and report id ready to make predictions via the API. You can also access your report id from the url as shown here “71a8db30-4f01-11ec-9851-1b12ccab24cb”

  3. Once you navigate to the Export tab of your prediction report, go straight down the page where you will find the ready to use API code for making individual predictions. You have the option to use either Python/JavaScript/Curl. You just need to click on the icon to copy the code and use it as it is. Your report id and API key will be already filled for that particular report

  4. /user/persona - create individual personas and predict their outcomes with your report. This endpoint enables to retrieve the following item from your prediction report using our platform - Probability: predicted outcome for an individual persona

    The body parameters are id and features and the header being your API authorization key.

    Here are a couple of working examples (one for regression and one for classification) of the /user/persona endpoint in Python. You just need to copy the code from the platform and paste it into your desired environment.

    Make sure that your API key and report id are correct. You can change the feature values, the same thing that you do when you are on the Personas section of the Predictions tab on the platform. Every time you change a value/values and run the code, you will receive the new results.

  5. /user/batch-persona - you can create personas and predict their outcomes in batches. This endpoint enables to retrieve the following item from your prediction report using our platform -
    Probabilities - predicted outcomes for a batch of personas

    The body parameters are the different personas with all required feature columns and their values for each persona and the Authorization is the API key associated with your account. You just need to be on the developers.obviously.ai webpage to copy the sample code and replace them with real values from your own data.

    An example is shown below:

  6. /user/batch-predict - use a CSV file with a list of items to predict their outcome. This endpoint enables to retrieve the following item from your prediction reports on our platform

    CSV file - containing prediction output for batch request

    The body parameters are id and file name and the header is the Authorization that is the API key for your account. Please make sure that you have a batch predict csv file ready to be used. You just need to be on the developers.obviously.ai webpage to copy the sample code and replace the path name with the path to your csv file

Did this answer your question?