# Predictions

## Different ways of predicting with Aito

You can use Aito to predict "things" via different means, which follow the same paths as the data uploads.

* Use [Aito HTTP API](https://aito.ai/docs/api/) to make requests to query endpoints, and read predictions from responses (JSON). Note that this is the most common option when using Aito with most of the automation platforms, such as Zapier, Integromat/Make and UiPath.
* Use [Aito Python SDK](https://aito-python-sdk.readthedocs.io/en/latest/quickstart.html#sdkquickstartsendquery)'s predict functions to send queries to Aito, and read the results from the response JSON. This would be the recommended method when working with a Python native platform, such as Robocorp.
* Use the [Airtable Extension](https://docs.aito.ai/integrations/airtable/predictions) to make get predictions automatically without code, based on your interactions with the Airtable base. **This is the recommended method for users not having a software development background.**

Regardless of the chosen method, the big picture is simple. Once you have a dataset in Aito, you can choose any of the available predictive functions and give needed inputs, and read the results from Aito's response. As a usage paradigm, this is closer to interacting with a database than a machine learning model.

An example of an Aito `_predict` query (request) would be for example:

```
{
  "from": "Titanic",
  "where": {
    "Pclass": 3,
    "Sex": "male"
  },
  "predict": "Survived"
}
```

The response to the said query would be as below, indicating only \~11% survival prediction for Titanic's male passengers with a third-class ticket. 😥

```
{
  "offset": 0,
  "total": 2,
  "hits": [
    {
      "$p": 0.8927479295163457,
      "field": "Survived",
      "feature": 0
    },
    {
      "$p": 0.1072520704836543,
      "field": "Survived",
      "feature": 1
    }
  ]
}
```

## What can you predict?

**First of all, at this point, only categorical predictions are supported.** We are planning to add support for other types of predictions (such as forecasting) later on.

The main types of predictions/queries are reflected in the Aito API as endpoints:

| Prediction type                                                     | Description                                                                                                                                                                                            |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [**Search**](https://aito.ai/docs/api/#post-api-v1-search)          | Allows you to search, filter, and order rows. You can also select only specific columns. Similar to *SELECT* in SQL. (You could argue this is not really "predict", but it's handy so we included it). |
| [**Predict**](https://aito.ai/docs/api/#post-api-v1-predict)        | Predict the likelihood of a feature ("your target") given some known inputs. For example, predict a category of expense claim row based on its place of purchase and description.                      |
| [**Recommend**](https://aito.ai/docs/api/#post-api-v1-recommend)    | Recommend a row from your dataset which optimizes a given goal. For example, you could ask Aito to choose a product, which maximizes the click likelihood, when user\_id equals 4543.                  |
| [**Similiarity**](https://aito.ai/docs/api/#post-api-v1-similarity) | Similarity returns entries from your dataset that are similar to the given sample object. The sample object can be either a complete or a partial row.                                                 |
| [**Match**](https://aito.ai/docs/api/#post-api-v1-match)            | Match gets you the most likely value/feature of a column or any column of a *linked table* to given known details or inputs.                                                                           |
| [**Relate**](https://aito.ai/docs/api/#post-api-v1-relate)          | Relate provides statistical information on data relationships. It calculates correlations between a pair of features, which can be used to for example find causation and correlation.                 |

## Testing predictions in Aito Console

An easy way to check that all things are working great is to test the predictions in Aito Console first. Once the data is uploaded, navigate to the Predictions tab. Check out this quick video, or ream more below.

{% embed url="<https://youtu.be/VazRGgle40Q>" %}

There you can choose any table and prediction target column from the dropdown. Aito then populates the request with one sample row from the data to give you a quick starting point. You may edit the input data, and remove unnecessary inputs. The right side shows your JSON request body in real-time.

![](https://1633683694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0XkpjEoxAHPaaMvAQgU%2Fuploads%2FcnO2pRbSoooIiSWjq4jd%2Fimage.png?alt=media\&token=c1c35d95-82bc-41b0-8409-604828c52b16)

Once the query is good, hit Predict and Aito returns the results.

The resulting view has both a visual representation of the probabilities, as well as the raw output that came with Aito's response.

![](https://1633683694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0XkpjEoxAHPaaMvAQgU%2Fuploads%2FcMj2yv9W8wpTgX6mXzh5%2Fimage.png?alt=media\&token=b64868d4-989d-4c75-8fe3-5f2a643693fb)

{% hint style="info" %}
**Note!** Predictions view on Console only supports Aito's Predict endpoint for now. You can not test other types, like Recommend, Match and so on yet.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aito.ai/the-basics/predictions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
