Get started using Aito Console
- Updated On 23 Jul 2020
- 6 Minutes To Read
-
Print
-
DarkLight
Before you begin
Getting an Aito instance
If you want to follow along with this get started guide, you'll have to go and get your own Aito instance from the Aito Console.
- Sign in or create an account, if you haven't got one already.
- In the Aito Console go to the instances page and click the "Create an instance" button.
- Select the instance type you want to create and fill in needed fields, Sandbox is the free instance for testing and small projects. Visit our pricing page, to learn more about the Aito instance types.
- Click "Create instance" and wait for a moment while your instance is created, you will receive an email once your instance is ready.
TL;DR
-
Log in to the Aito Console and click on your created instance, you should end up in the "Get started" tab if the instance is empty.
-
Download the missing-values.csv from the example files.
-
Upload the downloaded file using the CSV upload and leave the table name as missing-values.
-
Predict a Product_Category for an invoice
-
Copy the query as Curl and try out the predictions with your own invoice variables on the command line.
Intro
This get started guide uses the Kaggle dataset as an example of how to make predictions using Aito. The aim is to predict Product Category, from the given invoice information.
The dataset and problem framing are quite simple but they demonstrate the steps of how to work with Aito, so you can go ahead and start making predictions with your own data and answer the questions you are curious about.
The problem
When starting to use Aito, you will want to have the problem you're solving framed as a question to help with creating the queries. In this guide, we want to answer the question of "What is the correct product category for a new invoice?" by using the Kaggle invoice data (i.e. Invoice ID, Item description, GL code, etc.)
Data
Aito needs data from the past in order to make predictions for the future. The invoice dataset includes invoice details such as the class of the invoice ID, item description and so on. The details can be used to define the invoice we want to predict the product category for. The value we want to predict also has to be encoded in the data as a column (or a feature in data science terms), in this case, it is Product Category
. If the data comes as a CSV, it needs to be transformed into the JSON format for Aito.
Snapshot of the data
GL_Code | Inv_Amt | Inv_Id | Item_Description | Product_Category | Vendor_Code |
---|---|---|---|---|---|
GL-6100410 | 83.24 | 15001 | Artworking/Typesetting Production Jun 2009 Champion Parts Inc SMAP Prototype and Comp Production/Packaging Design | CLASS-1963 | VENDOR-1676 |
GL-2182000 | 51.18 | 15002 | Auto Leasing Corporate Services Corning Inc /Ny 2013-Mar Auto Leasing and Maintenance Other Corporate Services | CLASS-1250 | VENDOR-1883 |
Table schema definition
Data lives in Aito as tables. The CSV file of the Kaggle dataset will be put into Aito as one table which will be called missing-values. It is possible to use linked tables in Aito but in this example having just one table is enough.
In order to get data uploaded into Aito you will have to define the data schema for the missing-values table. By defining the schema you will tell Aito how to handle different columns in the data, for example, whether a column's values should be handled as integer or boolean values. Aito accepts numeric (integers, decimals), boolean, string and text data types. The variable nullable defines whether the column includes empty values, nullable: true
means the column can have empty values. Analyzers are used for text columns so columns whose values have longer sentences.
For the invoice dataset, the table schema can for example be defined as follows.
{
"schema": {
"lead-qualification": {
"type": "table",
"columns": {
"business_type": {
"type": "String",
"nullable": false
},
"case_won": {
"type": "Boolean",
"nullable": false
},
"company_revenue_last_year": {
"type": "Decimal",
"nullable": false
},
"company_type": {
"type": "String",
"nullable": false
},
"companyid": {
"type": "Int",
"nullable": false
},
"country": {
"type": "String",
"nullable": false
},
"number_of_employees": {
"type": "Int",
"nullable": false
},
"sales_rep": {
"type": "Int",
"nullable": false
}
}
}
}
}
Upload data
-
Click on the instance you have created. If the instance is empty you are taken straight to the Get started tab.
-
Download the missing-values.csv file from the Get started tab.
-
The data upload will take care of the whole process of schema inference, data transformation and data upload. You can upload the data just by simply using the CSV upload functionality in the Get started tab. Keep the table name as the missing-values.
- When the upload is ready, you will be shown a snapshot of the data. In reality, there are over 5000 rows in the database.
Run a query
Aito query's generic syntax
The aito query follows a syntax that is based on this rule:
From a given context (a specific table and what is known from that table), use an operation to find the known or the unknown.
{
"from" : define the initial context (table name),
"where" : more details of the context,
"operation_name" : operation to be perform,
"orderBy" : sort the result by some metric,
"select" : select specific attributes or parts of the result,
"offset" : define the number of rows in the result to be skipped,
"limit" : limit the number of rows to be shown in the result
}
Making the query
When the data is in Aito, you can start making queries to the data. Aito's query language resembles SQL in that it has the from
and where
clauses. In the query, we state that we want to use the data in the missing-values table, from: "missing-values"
, and the attributes of the invoice, we want to get the Product category for, are defined by where
. With the predict
clause we want to state which attribute we are predicting, in this case, it's Product_Category.
In the Get started tab of the Aito Console, the variables in the where
clause are preselected randomly from the uploaded data.
- Change the field to be Product_Category
- In the window you can see the query which is sent to Aito.
- Hit the
Execute query
button.
Results
For the query, Aito will return the following result (your results may vary depending on which values you got in the query's where
clause).
From the result $p
is the probability of the field
having a feature
. So as stated in the response explanation with 100% probability, the invoice defined in the where
clause would belong to the CLASS-1522 Product category. The 100% probability is due to the invoice definition coming from an invoice which is already classified in the database, with a new invoice the probability would be lower as it's "unseen" data for Aito.
In reality, Aito also returns the probabilities of the field having other features. In the case of the Product category the variable is categorical so Aito would return results for all of the possible categories.
What next
You can try out how creating invoices with new data would affect the results by changing the attributes defined in the query's where
clause. You can copy the query as Curl from the Aito Console, change the attributes and run the command on your command line.
Check out the related articles to upload your own data into Aito and start making queries that answer the questions that interest you. Or familiarize yourself to our other Get started articles. For more information on the Console you can check the How to use the Aito Console article.