Example gallery/Why do products get good or bad ratings?
Example level
Medium
Endpoints
Dataset

Why do products get good or bad ratings?

To understand the example better, please read what data the Generated Ecommerce dataset contains

The dataset contains products and reviews. Let's investigate what words seem to correlate with good or bad reviews. The best way to investigate correlations like this is using Relate query.

How does product category correlate with its rating?

Aito doesn't yet fully support numbers. See number support article for more.

You can copy-paste the command to your terminal and test it out!

curl -X POST \
  https://aito-generated-ecom.api.aito.ai/api/v1/_relate \
  -H 'content-type: application/json' \
  -H 'x-api-key: iIZThrosrFaIV1wYCBYRM1rtluY9ZIIY19P6VOTP' \
  -d '
  {
    "from": "products",
    "where": {
      "$exists": ["average_product_rating"]
    },
    "relate": "category",
    "orderBy": "info.miTrue"
  }'

Response should look like:

{
  "offset" : 0,
  "total" : 1705,
  "hits" : [ {
    "related" : "category:ankle boots & booties",
    "lift" : 635.4979366503635,
    "condition" : "average_product_rating:1.7",
    "fs" : {
      "f" : 8,
      "fOnCondition" : 1,
      "fOnNotCondition" : 7,
      "fCondition" : 1,
      "n" : 10148
    },
    "ps" : {
      "p" : 7.887756244086366E-4,
      "pOnCondition" : 0.5012652817917906,
      "pOnNotCondition" : 7.380259347498845E-4,
      "pCondition" : 1.0093842574608218E-4
    },
    "info" : {
      "h" : 0.009268289736762036,
      "mi" : 4.167663738172232,
      "miTrue" : 4.667653795084118,
      "miFalse" : -0.49999005691188647
    },
    "relation" : {
      "n" : 10148,
      "varFs" : [ 1, 8 ],
      "stateFs" : [ 10140, 0, 7, 1 ],
      "mi" : 4.2313143499662925E-4
    }
  }, {
    "related" : "category:vacuums & floorcare",
    "lift" : 317.757442363554,
    "condition" : "average_product_rating:1.6",
    "fs" : {
      "f" : 16,
      "fOnCondition" : 1,
      "fOnNotCondition" : 15,
      "fCondition" : 1,
      "n" : 10148
    },

  ...

The response contains a lot of statistical properties for different analysis, but the commonly important ones are:

  • "related" : "category:ankle boots & booties", the correlating feature.
  • "lift" : 635.4979366503635, Ankle boots & booties have 1.7 rating 635x more likely than the average. The number is very high and normally it would mean a very large anomaly. In the example it's caused by how floating point numbers are analysed.
  • info.miTrue the mutual information factor, which indicates how strong the correlation is.

Relate offers great possibilities to explore and understand your data. Check out our API docs for a few other examples.

Visit us

Annankatu 34 B

00100 Helsinki

Finland

See map

26 Underwood Street

N1 7JQ

London, UK

See map

Contact info

We'd love to hear from you.

hello@aito.ai

Follow us