Authentication

Like other API endpoints, the  /predict/  endpoint uses a Bearer Token for authentication. You can grab a token from https://api.intersectlabs.io/settings

Predicting from a JSON object

All the columns in the original training data must be present as keys in your JSON object. You may use extra keys – the first key will be returned along with the prediction from the API, so feel free to send in an extra identifier key.

Below is an example of an API call. You can grab the Project Id from the model report page.

curl -X POST "https://api.intersectlabs.io/predict/"
-F data='[{"id": "idXudajni", "key1": "value1", "key2": "value2"}]'
-F project=<project_id>
-H "Authorization: Bearer <token>"

Returns

JSON object with first key value pair (should be used as identifier), and prediction. If the project is a classifier, the likelihoods of each category are returned as the prediction (the likelihoods add up to 1.0).

{
  "id": "idXudajni",
  "prediction_column": {
    "Pass": 0.82,
    "Fail": 0.18
  }
}

Predicting from a CSV file

All the columns in the original training data must be present in the CSV file. Extra columns may be added as necessary - predictions are returned for each row, along with the values in the first column -- these should be used as identifiers. An extra column may be added to the csv for that purpose. 

Below is an example of an API call. You can grab the Project Id from the model report page.

curl -X POST "https://api.intersectlabs.io/predict/"
-F file=@<file.csv>
-F project=<project_id>
-H "Authorization: Bearer <token>" 

Returns

JSON object with first column (should be used as identifier), and prediction. If the project is a classifier, the likelihoods of each category are returned as the prediction (the likelihoods add up to 1.0). 

{
  "id": "idXudajni",
  "prediction_column": {
    "Pass": 0.82,
    "Fail": 0.18
  }
}
Did this answer your question?