DEV Community

Cover image for Machine learning (ML) applications: ranking
Mage
Mage

Posted on

Machine learning (ML) applications: ranking

TLDR

Ranking is a type of machine learning that sorts data in a relevant order. Companies use ranking to optimize search and recommendations.

Outline

  • What is a ranking model?

  • How does ranking work?

  • Why should I care?

  • Use cases

  • The fastest way to build a ranking model

What is a ranking model?

Ranking is a type of supervised machine learning (ML) that uses labeled datasets to train its data and models to classify future data to predict outcomes. Quite simply, the goal of a ranking model is to sort data in an optimal and relevant order.
Ranking was first largely deployed within search engines. People search for a topic, while the ranking algorithm reorders search results based on the PageRank, and the search engine is able to display the most relevant results to its customers.
Until recently, most ranking models, and ML as whole, were limited in their scope of use, as most companies didn’t have enough data to power these algorithms. Better methods for data collection and more intuitive ML tools have made it possible for nearly anyone to deploy a successful ranking model within their business.

How does ranking work?

As we’ll discuss later in this blog, ranking is incredibly versatile and dependent on the data a company has. Even so, a common framework guides the construction of all ranking models.
Ranking models are made up of 2 main factors: queries and documents. Queries are any input value, such as a question on Google or an interaction on an e-commerce site. Documents are the output value or results of the query. Given the query, and the associated documents, a function, given a list of parameters to rank on, will score the documents to be sorted in order of relevancy.
The machine learning algorithm learning to rank takes the scores from this model, and uses them to predict future outcomes on a new and unseen list of documents.

Image description

As an example, a search for “Mage” is done on Google Search (“Mage” is the query). After the search, a list of associated documents matching the query will be displayed (Mage A.I., Mage definition, Mage World of Warcraft, etc.). The function will score each of the documents based on their relevance to the query (Mage A.I. = 1, Mage definition = 2, Mage World of Warcraft =3, and so on). The documents with higher scores will be ranked higher when there is a search for Mage.
Data required for a ranking model consists of documents from a query, user profiles, user behaviors, search history, clicks, etc.

Why should I care?

Ranking ensures that the most relevant results appear first on a customer’s search, maximizing the chances they will find something of interest, and minimizing the chances of churn. With so many options for organic web search, the need to stay competitive has never been greater. According to a Google study, 61% of users said if they didn’t find what they were looking for right away, they would quickly move on to another site. Depending on available data, companies can use ranking within their web pages and apps to serve their customers the most relevant results as soon as they enter.

Use cases:

The most successful companies are using ranking within their software to improve the user experience. Ranking has allowed these companies to create customized feeds for each user based on their past search and buying history. Ranking carries many use cases across industries, nearly anyone with data can and should be using ranking in some capacity to optimize their business. A few use cases are:

  1. Search results
  2. Targeted ads
  3. Recommendations

Here are a few companies who have used ranking to maximize user engagement.

  • Amazon
    With millions of listings or documents, for every product search or query, Amazon needed to find a way to rank its products in order to maximize the chance of purchase. Using a combination of individual preferences, gathered from users' search and purchasing history and a product’s popularity, Amazon created a ranking system that would display the most relevant products at the top of their feed. Additionally, ranking was used in Amazon’s recommendation system, which would use users' ranked preferences in order to predict what products a user is most likely to purchase in the future.

  • Netflix
    Similar to Amazon, Netflix uses ranking to fuel their recommendation system. The recommendation system predicts what content a user is most likely to watch and displays the most relevant content at the top of the home page. Netflix uses a few different features to rank and recommend content; such as: watch history, search history, and general popularity. They also use ranking to fuel their collaborative filtering.

  • TikTok
    TikTok’s standout feature is the For You page which is built on a ranking system. This feature has allowed TikTok to customize each home page to be reflective of the preferences and interests of its user. TikTok uses similar metrics to Netflix to rank its content: watch history, re-watch rate, and engagement. Similar to Netflix, TikTok’s ranking system also aids in collaborative filtering.

- Starbucks
Starbucks found great success with their mobile app, which is one of the most downloaded apps on the App Store. The app allows Starbucks to create a custom user experience for their customers even when they’re not within a physical coffee shop. The app uses ranking to recommend the most relevant products to users. Taking into account order history, new products and general popularity of other products, Starbucks is able to keep customers' favorite orders at the top of the recommended search while introducing them to new products that they are most likely to enjoy.

The fastest way to build a ranking model

For the companies listed above, entire teams of data scientists and AI engineers were built to create and maintain the ranking systems in place. The cost to build these teams is impractical for most businesses. Recently, there have been great tools emerging which allow for the easy building and deployment of ranking models–this with little to no programming experience.
Mage allows for the building and deployment of a ranking model with no ML programming knowledge. To use Mage, a database containing a list of queries and documents is first uploaded. Queries could contain a list of clothes or menu items, their documents could be the number of engagement (clicks and purchases) each received. The greater the quality and quantity of data uploaded, the better that Mage is able to produce ranking predictions.
Once the data is uploaded, users will be given the option to transform their datasets by removing and adding columns, applying transformer actions: split and filter data, group values, aggregate data, and identifying what columns they would like to rank. Mage will then produce a ranking model which can be deployed into your data warehouses, downloaded to a CSV file, or saved directly to a Mage dataset.

If you’d like to create a ranking model of your own to begin customizing your customer experience, you can get started here for free: Mage.ai

Top comments (1)

Collapse
 
dangerous profile image
Tommy DANGerous

Did fortune tellers back in the day just use AI models to predict the fortune of people? Were the tarot cards just training data?