We are excited to announce the release of Aito Python SDK 0.4.0 which makes predicting with Aito easier than ever. In this new version, we've added new commands to the Aito CLI: search, predict, recommend, evaluate, similarity, match, relate, and query that help you send the query to the Aito API Endpoint without having to write the curl command yourself, a full changelog is available here. This post will cover an example on how to make your first prediction with the new Aito CLI's predictcommand. Let's start!


Before getting to the heart of the matter, the following things need to be prepared.

Get your Aito instance

  1. Create an account and login at .
  2. Click the 'Create a new instance' button which will land you on the instance creation page. Here you can choose between Sandbox, Dev, or Product instance, a free Sandbox instance is sufficient for this tutorial. Click 'Create instance' and go grab a coffee, an email will be sent once your instance is ready.
  3. On the newly created instance dashboard, grab your instance url and API key for the next step.
instance dashboard
Grab you instance url and API key

Prepare your data

This post will use a sample data set from the Titanic data from Kaggle. You can download the example data train.csv here. Feel free to use your own data if you have any.

Here is the snapshot of the example data:

313Heikkinen, Miss. Lainafemale2600STON/O2. 31012827.925S
411Futrelle, Mrs. Jacques Heath (Lily May Peel)female351011380353.1C123S
503Allen, Mr. William Henrymale35003734508.05S

As can be seen from the table, the data includes passenger info such as name, sex, age, class and so on. Let's say we want to predict the survival chance of one specific passenger, we can use these info to describe a passenger. Please note that the value we want to predict has to be included in the data as a column, which is Survived in this case.

Install the Aito CLI tool

The Aito CLI tool requires Python 3.6 or higher installed. Documentation is available here

Install Aito CLI

pip install aitoai

After this, you can run aito --help to get general information on the Aito CLI tool.

The three steps to prediction

Now with the data in hand and Aito CLI installed, you can start your first prediction with Aito and I promise it will be done in a blink of an eye.

1. Configure the CLI

You will need to provide your instance URL and API key to access your instance from the Aito CLI tool. You can do this by running:

aito configure

The command line will ask you to fill in the instance URL and API key, copy them from the Console and you are good to go.

2. Upload data

Then you will need to add your data table into Aito with the following command.

aito quick-add-table -n Titanic train.csv

aito quick-add-table will infer a table schema based on the given file, create a table and upload the file content to the created table. In this case, I used the option -n TABLE_NAME to specify that I want my table to be named Titanic, if you do not specify that, the file name will be used. For more information on this command, check aito quick-add-table -h

3. Predict!

Next, use the new predict command.

aito predict '{"from": "Titanic", "where": {"Age": 30, "Sex": "male"}, "predict": "Survived"}'

This predict command is followed by an Aito query, which has similar clauses as SQL query language like from and where. Let's translate the query to human-readable language: predict the Survival of passengers whose Sex is male and at the Age of 30 using data from table Titanic. You can try to change the passenger attributes to see how it affects the result.

The query will then be sent to /api/v1/_predict API endpoint and Aito will return the following result.

  "offset": 0,
  "total": 2,
  "hits": [
      "$p": 0.8106108369824419,
      "field": "Survived",
      "feature": 0
      "$p": 0.18938916301755815,
      "field": "Survived",
      "feature": 1

The result can be explained as follows: there is a 81% chance that a male passenger at the age of 30 didn't survive, and 19% chance for that passenger to survive.

Wrapping up

Above is how to make predictions with our latest version of Aito Python SDK 0.4.0. Feel free to give it a try with your own data and join our Slack for any further discussion or feedback. Cheers!

Back to blog list

Fast track to machine learning starts with a free Aito Sandbox.


Aito Intelligence Oy

c/o Innovation Home

Toinen Linja 14

00530 Helsinki


VAT ID FI28756352

See map

470 Ramona St.

Palo Alto

CA 94301, USA

See map


COVID-19 situation has driven us all to work from homes, please connect with us online. Stay safe & play with data!

About usContact usJoin our Slack workspace

Follow us