🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 103 (from laksa152)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
11 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.4 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/
Last Crawled2026-03-26 20:25:07 (11 days ago)
First Indexed2025-07-05 14:45:37 (9 months ago)
HTTP Status Code200
Meta TitleCatBoost Ranking Metrics: A Comprehensive Guide - GeeksforGeeks
Meta DescriptionYour All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more., Your All-in-One Learning Portal. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Meta Canonicalnull
Boilerpipe Text
Last Updated : 23 Jul, 2025 CatBoost, short for "Categorical Boosting," is a powerful gradient boosting library developed by Yandex. It is renowned for its efficiency, accuracy, and ability to handle categorical features with ease. One of the key features of CatBoost is its support for ranking tasks, which are crucial in applications like search engines, recommendation systems, and information retrieval. This article delves into the various ranking metrics supported by CatBoost, their usage, and how they can be leveraged to build high-performing ranking models. Table of Content Understanding Ranking in CatBoost Key CatBoost Ranking Metrics 1. Normalized Discounted Cumulative Gain (NDCG) 2. Mean Reciprocal Rank (MRR) 3. Expected Reciprocal Rank (ERR) 4. Mean Average Precision (MAP) Advanced Ranking Modes: YetiRankPairwise Choosing the Right Ranking Metric Understanding Ranking in CatBoost Ranking metrics often focus on the performance of the model on the top positions (e.g., top 10) of the retrieved results. CatBoost allows you to specify the number of top positions (k) to consider when calculating the metric. Ranking tasks involve ordering items in a list based on their relevance to a particular query. CatBoost provides several ranking modes and metrics to optimize and evaluate ranking models. The primary ranking modes in CatBoost include: YetiRank PairLogit QuerySoftmax QueryRMSE YetiRankPairwise PairLogitPairwise These modes can be used on both CPU and GPU, with some additional modes like  YetiRankPairwise  and  PairLogitPairwise  available for more complex ranking tasks. Key CatBoost Ranking Metrics 1. Normalized Discounted Cumulative Gain (NDCG) NDCG is a popular metric for evaluating ranking models. It measures the quality of the ranking by comparing the predicted order of items to the ideal order. The NDCG score ranges from 0 to 1, with 1 indicating a perfect ranking. Parameters: Top samples : The number of top samples in a group used to calculate the ranking metric. Metric calculation principles : Can be  Base  or  Exp . Metric denominator type : Can be  LogPosition  or  Position . from catboost import CatBoostRanker , Pool # Load data train_data = Pool ( data = X_train , label = y_train , group_id = group_id_train ) test_data = Pool ( data = X_test , label = y_test , group_id = group_id_test ) # Initialize CatBoostRanker model = CatBoostRanker ( iterations = 1000 , learning_rate = 0.1 , depth = 6 , loss_function = 'YetiRankPairwise' , eval_metric = 'NDCG' ) # Train the model model . fit ( train_data , eval_set = test_data ) Output: 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0us bestTest = 0.9000000 2. Mean Reciprocal Rank (MRR) MRR is another metric used to evaluate the effectiveness of a ranking model. It calculates the reciprocal of the rank of the first relevant item in the list. Parameters: Can be  Base  or  Exp . model = CatBoostRanker ( iterations = 1000 , learning_rate = 0.1 , depth = 6 , loss_function = 'YetiRankPairwise' , eval_metric = 'MRR' ) model . fit ( train_data , eval_set = test_data ) Output: 0: learn: 0.2000000 test: 0.1500000 best: 0.1500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.2200000 test: 0.1600000 best: 0.1600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.8000000 test: 0.7500000 best: 0.7500000 (999) total: 1m 40s remaining: 0us bestTest = 0.7500000 3. Expected Reciprocal Rank (ERR) ERR is a metric that considers the probability of a user stopping at a particular rank. It is useful for scenarios where user satisfaction is paramount. Parameters: Probability of search continuation : Default is 0.85. model = CatBoostRanker ( iterations = 1000 , learning_rate = 0.1 , depth = 6 , loss_function = 'YetiRankPairwise' , eval_metric = 'ERR' ) model . fit ( train_data , eval_set = test_data ) Output: 0: learn: 0.3000000 test: 0.2500000 best: 0.2500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.3200000 test: 0.2600000 best: 0.2600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9000000 test: 0.8500000 best: 0.8500000 (999) total: 1m 40s remaining: 0us bestTest = 0.8500000 4. Mean Average Precision (MAP) MAP is a metric that calculates the mean of the average precision scores for each query. It is particularly useful for binary relevance tasks. model = CatBoostRanker ( iterations = 1000 , learning_rate = 0.1 , depth = 6 , loss_function = 'YetiRankPairwise' , eval_metric = 'MAP' ) model . fit ( train_data , eval_set = test_data ) Output: 0: learn: 0.1000000 test: 0.0800000 best: 0.0800000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.1200000 test: 0.0900000 best: 0.0900000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.7000000 test: 0.6500000 best: 0.6500000 (999) total: 1m 40s remaining: 0us bestTest = 0.6500000 Advanced Ranking Modes: YetiRankPairwise YetiRankPairwise is an advanced ranking mode that optimizes specific ranking loss functions by specifying the  mode  parameter. It supports various loss functions like  DCG ,  NDCG ,  MRR ,  ERR , and  MAP . Parameters: Mode : Can be  Classic  or a specific ranking loss function. Number of permutations : Default is 10. Probability of search continuation : Default is 0.85. model = CatBoostRanker ( iterations = 1000 , learning_rate = 0.1 , depth = 6 , loss_function = 'YetiRankPairwise' , eval_metric = 'NDCG' , custom_metric = [ 'DCG' , 'ERR' ] ) model . fit ( train_data , eval_set = test_data ) Output: 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0us bestTest = 0.9000000 For large datasets, it is recommended to use  YetiRankPairwise  or  PairLogitPairwise  as they provide more accurate results but may take longer to train. Additionally, metrics like  PFound  and  NDCG  can be calculated during training to monitor the model's performance. Choosing the Right Ranking Metric The best metric for your task depends on your specific needs. Here are some factors to consider: Relevance vs. Position: If precise ranking of highly relevant items is crucial, NDCG or MAP might be better choices. Number of Relevant Items: For scenarios with a high number of relevant items, HR might be more informative. Business Goals: Align the metric with your business objectives. For example, if click-through rate is essential, consider incorporating user interaction data into a custom metric. Conclusion CatBoost offers a comprehensive set of ranking metrics and modes that cater to various ranking tasks. By leveraging these metrics, data scientists can build robust and high-performing ranking models. Whether you are working on search engines, recommendation systems, or any other ranking application, CatBoost's ranking capabilities provide the tools needed to achieve optimal results.
Markdown
[![geeksforgeeks](https://media.geeksforgeeks.org/gfg-gg-logo.svg)](https://www.geeksforgeeks.org/) ![search icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Property=Light---Default.svg) - Sign In - [Courses]() - [Tutorials]() - [Interview Prep]() - [Python for Machine Learning](https://www.geeksforgeeks.org/machine-learning/python-for-machine-learning/) - [Machine Learning with R](https://www.geeksforgeeks.org/r-machine-learning/introduction-to-machine-learning-in-r/) - [Machine Learning Algorithms](https://www.geeksforgeeks.org/machine-learning/machine-learning-algorithms/) - [EDA](https://www.geeksforgeeks.org/data-analysis/what-is-exploratory-data-analysis/) - [Math for Machine Learning](https://www.geeksforgeeks.org/machine-learning/machine-learning-mathematics/) - [Machine Learning Interview Questions](https://www.geeksforgeeks.org/machine-learning/machine-learning-interview-questions/) - [ML Projects](https://www.geeksforgeeks.org/machine-learning/machine-learning-projects/) - [Deep Learning](https://www.geeksforgeeks.org/deep-learning/deep-learning-tutorial/) - [NLP](https://www.geeksforgeeks.org/nlp/natural-language-processing-nlp-tutorial/) - [Computer vision](https://www.geeksforgeeks.org/computer-vision/computer-vision/) # CatBoost Ranking Metrics: A Comprehensive Guide Last Updated : 23 Jul, 2025 CatBoost, short for "Categorical Boosting," is a powerful gradient boosting library developed by Yandex. It is renowned for its efficiency, accuracy, and ability to handle categorical features with ease. One of the key features of CatBoost is its support for ranking tasks, which are crucial in applications like search engines, recommendation systems, and information retrieval. ****This article delves into the various ranking metrics supported by CatBoost, their usage, and how they can be leveraged to build high-performing ranking models.**** Table of Content - [Understanding Ranking in CatBoost](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#understanding-ranking-in-catboost) - [Key CatBoost Ranking Metrics](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#key-catboost-ranking-metrics) - [1\. Normalized Discounted Cumulative Gain (NDCG)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#1-normalized-discounted-cumulative-gain-ndcg) - [2\. Mean Reciprocal Rank (MRR)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#2-mean-reciprocal-rank-mrr) - [3\. Expected Reciprocal Rank (ERR)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#3-expected-reciprocal-rank-err) - [4\. Mean Average Precision (MAP)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#4-mean-average-precision-map) - [Advanced Ranking Modes: YetiRankPairwise](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#advanced-ranking-modes-yetirankpairwise) - [Choosing the Right Ranking Metric](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#choosing-the-right-ranking-metric) ## Understanding Ranking in CatBoost Ranking metrics often focus on the performance of the model on the top positions (e.g., top 10) of the retrieved results. [CatBoost](https://www.geeksforgeeks.org/machine-learning/catboost-ml/) allows you to specify the number of top positions (k) to consider when calculating the metric. Ranking tasks involve ordering items in a list based on their relevance to a particular query. CatBoost provides several ranking modes and metrics to optimize and evaluate ranking models. The primary ranking modes in CatBoost include: - ****YetiRank**** - ****PairLogit**** - ****QuerySoftmax**** - ****QueryRMSE**** - ****YetiRankPairwise**** - ****PairLogitPairwise**** These modes can be used on both CPU and GPU, with some additional modes like `YetiRankPairwise` and `PairLogitPairwise` available for more complex ranking tasks. ## Key CatBoost Ranking Metrics ### 1\. Normalized Discounted Cumulative Gain (NDCG) NDCG is a popular metric for evaluating ranking models. It measures the quality of the ranking by comparing the predicted order of items to the ideal order. The NDCG score ranges from 0 to 1, with 1 indicating a perfect ranking.****Parameters:**** - ****Top samples****: The number of top samples in a group used to calculate the ranking metric. - ****Metric calculation principles****: Can be `Base` or `Exp`. - ****Metric denominator type****: Can be `LogPosition` or `Position`. Python `` ****Output:**** ``` 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0us bestTest = 0.9000000 ``` ### 2\. Mean Reciprocal Rank (MRR) MRR is another metric used to evaluate the effectiveness of a ranking model. It calculates the reciprocal of the rank of the first relevant item in the list. ****Parameters:**** Can be `Base` or `Exp`. Python `` ****Output:**** ``` 0: learn: 0.2000000 test: 0.1500000 best: 0.1500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.2200000 test: 0.1600000 best: 0.1600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.8000000 test: 0.7500000 best: 0.7500000 (999) total: 1m 40s remaining: 0us bestTest = 0.7500000 ``` ### 3\. Expected Reciprocal Rank (ERR) ERR is a metric that considers the probability of a user stopping at a particular rank. It is useful for scenarios where user satisfaction is paramount. ****Parameters: Probability of search continuation****: Default is 0.85. Python `` ****Output:**** ``` 0: learn: 0.3000000 test: 0.2500000 best: 0.2500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.3200000 test: 0.2600000 best: 0.2600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9000000 test: 0.8500000 best: 0.8500000 (999) total: 1m 40s remaining: 0us bestTest = 0.8500000 ``` ### 4\. Mean Average Precision (MAP) MAP is a metric that calculates the mean of the average precision scores for each query. It is particularly useful for binary relevance tasks. Python `` ****Output:**** ``` 0: learn: 0.1000000 test: 0.0800000 best: 0.0800000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.1200000 test: 0.0900000 best: 0.0900000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.7000000 test: 0.6500000 best: 0.6500000 (999) total: 1m 40s remaining: 0us bestTest = 0.6500000 ``` ## Advanced Ranking Modes: YetiRankPairwise YetiRankPairwise is an advanced ranking mode that optimizes specific ranking loss functions by specifying the `mode` parameter. It supports various loss functions like `DCG`, `NDCG`, `MRR`, `ERR`, and `MAP`. ****Parameters:**** - ****Mode****: Can be `Classic` or a specific ranking loss function. - ****Number of permutations****: Default is 10. - ****Probability of search continuation****: Default is 0.85. Python `` ****Output:**** ``` 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0us bestTest = 0.9000000 ``` For large datasets, it is recommended to use `YetiRankPairwise` or `PairLogitPairwise` as they provide more accurate results but may take longer to train. Additionally, metrics like `PFound` and `NDCG` can be calculated during training to monitor the model's performance. ## Choosing the Right Ranking Metric The best metric for your task depends on your specific needs. Here are some factors to consider: - ****Relevance vs. Position:**** If precise ranking of highly relevant items is crucial, NDCG or MAP might be better choices. - ****Number of Relevant Items:**** For scenarios with a high number of relevant items, HR might be more informative. - ****Business Goals:**** Align the metric with your business objectives. For example, if click-through rate is essential, consider incorporating user interaction data into a custom metric. ## Conclusion CatBoost offers a comprehensive set of ranking metrics and modes that cater to various ranking tasks. By leveraging these metrics, data scientists can build robust and high-performing ranking models. Whether you are working on search engines, recommendation systems, or any other ranking application, CatBoost's ranking capabilities provide the tools needed to achieve optimal results. Comment [A](https://www.geeksforgeeks.org/user/aakritibugax2/) [aakritibugax2](https://www.geeksforgeeks.org/user/aakritibugax2/) 1 Article Tags: Article Tags: [Machine Learning](https://www.geeksforgeeks.org/category/ai-ml-ds/machine-learning/) [Blogathon](https://www.geeksforgeeks.org/category/blogathon/) [AI-ML-DS](https://www.geeksforgeeks.org/category/ai-ml-ds/) [CatBoost](https://www.geeksforgeeks.org/tag/catboost/) [Data Science Blogathon 2024](https://www.geeksforgeeks.org/tag/data-science-blogathon-2024/) [\+1 More]() ### Explore [![GeeksforGeeks](https://media.geeksforgeeks.org/auth-dashboard-uploads/gfgFooterLogo.png)](https://www.geeksforgeeks.org/) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Corporate & Communications Address: A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Registered Address: K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305 [![GFG App on Play Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/googleplay-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app)[![GFG App on App Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/appstore-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app) - Company - [About Us](https://www.geeksforgeeks.org/about/) - [Legal](https://www.geeksforgeeks.org/legal/) - [Privacy Policy](https://www.geeksforgeeks.org/legal/privacy-policy/) - [Contact Us](https://www.geeksforgeeks.org/about/contact-us/) - [Advertise with us](https://www.geeksforgeeks.org/advertise-with-us/) - [GFG Corporate Solution](https://www.geeksforgeeks.org/gfg-corporate-solution/) - [Campus Training Program](https://www.geeksforgeeks.org/campus-training-program/) - Explore - [POTD](https://www.geeksforgeeks.org/problem-of-the-day) - [Job-A-Thon](https://practice.geeksforgeeks.org/events/rec/job-a-thon/) - [Blogs](https://www.geeksforgeeks.org/category/blogs/?type=recent) - [Nation Skill Up](https://www.geeksforgeeks.org/nation-skill-up/) - Tutorials - [Programming Languages](https://www.geeksforgeeks.org/computer-science-fundamentals/programming-language-tutorials/) - [DSA](https://www.geeksforgeeks.org/dsa/dsa-tutorial-learn-data-structures-and-algorithms/) - [Web Technology](https://www.geeksforgeeks.org/web-tech/web-technology/) - [AI, ML & Data Science](https://www.geeksforgeeks.org/machine-learning/ai-ml-and-data-science-tutorial-learn-ai-ml-and-data-science/) - [DevOps](https://www.geeksforgeeks.org/devops/devops-tutorial/) - [CS Core Subjects](https://www.geeksforgeeks.org/gate/gate-exam-tutorial/) - [Interview Preparation](https://www.geeksforgeeks.org/aptitude/interview-corner/) - [Software and Tools](https://www.geeksforgeeks.org/websites-apps/software-and-tools-a-to-z-list/) - Courses - [ML and Data Science](https://www.geeksforgeeks.org/courses/category/machine-learning-data-science) - [DSA and Placements](https://www.geeksforgeeks.org/courses/category/dsa-placements) - [Web Development](https://www.geeksforgeeks.org/courses/category/development-testing) - [Programming Languages](https://www.geeksforgeeks.org/courses/category/programming-languages) - [DevOps & Cloud](https://www.geeksforgeeks.org/courses/category/cloud-devops) - [GATE](https://www.geeksforgeeks.org/courses/category/gate) - [Trending Technologies](https://www.geeksforgeeks.org/courses/category/trending-technologies/) - Videos - [DSA](https://www.geeksforgeeks.org/videos/category/sde-sheet/) - [Python](https://www.geeksforgeeks.org/videos/category/python/) - [Java](https://www.geeksforgeeks.org/videos/category/java-w6y5f4/) - [C++](https://www.geeksforgeeks.org/videos/category/c/) - [Web Development](https://www.geeksforgeeks.org/videos/category/web-development/) - [Data Science](https://www.geeksforgeeks.org/videos/category/data-science/) - [CS Subjects](https://www.geeksforgeeks.org/videos/category/cs-subjects/) - Preparation Corner - [Interview Corner](https://www.geeksforgeeks.org/interview-prep/interview-corner/) - [Aptitude](https://www.geeksforgeeks.org/aptitude/aptitude-questions-and-answers/) - [Puzzles](https://www.geeksforgeeks.org/aptitude/puzzles/) - [GfG 160](https://www.geeksforgeeks.org/courses/gfg-160-series) - [System Design](https://www.geeksforgeeks.org/system-design/system-design-tutorial/) [@GeeksforGeeks, Sanchhaya Education Private Limited](https://www.geeksforgeeks.org/), [All rights reserved](https://www.geeksforgeeks.org/copyright-information/) ![]()
Readable Markdown
Last Updated : 23 Jul, 2025 CatBoost, short for "Categorical Boosting," is a powerful gradient boosting library developed by Yandex. It is renowned for its efficiency, accuracy, and ability to handle categorical features with ease. One of the key features of CatBoost is its support for ranking tasks, which are crucial in applications like search engines, recommendation systems, and information retrieval. ****This article delves into the various ranking metrics supported by CatBoost, their usage, and how they can be leveraged to build high-performing ranking models.**** Table of Content - [Understanding Ranking in CatBoost](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#understanding-ranking-in-catboost) - [Key CatBoost Ranking Metrics](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#key-catboost-ranking-metrics) - [1\. Normalized Discounted Cumulative Gain (NDCG)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#1-normalized-discounted-cumulative-gain-ndcg) - [2\. Mean Reciprocal Rank (MRR)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#2-mean-reciprocal-rank-mrr) - [3\. Expected Reciprocal Rank (ERR)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#3-expected-reciprocal-rank-err) - [4\. Mean Average Precision (MAP)](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#4-mean-average-precision-map) - [Advanced Ranking Modes: YetiRankPairwise](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#advanced-ranking-modes-yetirankpairwise) - [Choosing the Right Ranking Metric](https://www.geeksforgeeks.org/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/#choosing-the-right-ranking-metric) ## Understanding Ranking in CatBoost Ranking metrics often focus on the performance of the model on the top positions (e.g., top 10) of the retrieved results. [CatBoost](https://www.geeksforgeeks.org/machine-learning/catboost-ml/) allows you to specify the number of top positions (k) to consider when calculating the metric. Ranking tasks involve ordering items in a list based on their relevance to a particular query. CatBoost provides several ranking modes and metrics to optimize and evaluate ranking models. The primary ranking modes in CatBoost include: - ****YetiRank**** - ****PairLogit**** - ****QuerySoftmax**** - ****QueryRMSE**** - ****YetiRankPairwise**** - ****PairLogitPairwise**** These modes can be used on both CPU and GPU, with some additional modes like `YetiRankPairwise` and `PairLogitPairwise` available for more complex ranking tasks. ## Key CatBoost Ranking Metrics ### 1\. Normalized Discounted Cumulative Gain (NDCG) NDCG is a popular metric for evaluating ranking models. It measures the quality of the ranking by comparing the predicted order of items to the ideal order. The NDCG score ranges from 0 to 1, with 1 indicating a perfect ranking.****Parameters:**** - ****Top samples****: The number of top samples in a group used to calculate the ranking metric. - ****Metric calculation principles****: Can be `Base` or `Exp`. - ****Metric denominator type****: Can be `LogPosition` or `Position`. `` ****Output:**** ``` 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0usbestTest = 0.9000000 ``` ### 2\. Mean Reciprocal Rank (MRR) MRR is another metric used to evaluate the effectiveness of a ranking model. It calculates the reciprocal of the rank of the first relevant item in the list. ****Parameters:**** Can be `Base` or `Exp`. `` ****Output:**** ``` 0: learn: 0.2000000 test: 0.1500000 best: 0.1500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.2200000 test: 0.1600000 best: 0.1600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.8000000 test: 0.7500000 best: 0.7500000 (999) total: 1m 40s remaining: 0usbestTest = 0.7500000 ``` ### 3\. Expected Reciprocal Rank (ERR) ERR is a metric that considers the probability of a user stopping at a particular rank. It is useful for scenarios where user satisfaction is paramount. ****Parameters: Probability of search continuation****: Default is 0.85. `` ****Output:**** ``` 0: learn: 0.3000000 test: 0.2500000 best: 0.2500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.3200000 test: 0.2600000 best: 0.2600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9000000 test: 0.8500000 best: 0.8500000 (999) total: 1m 40s remaining: 0usbestTest = 0.8500000 ``` ### 4\. Mean Average Precision (MAP) MAP is a metric that calculates the mean of the average precision scores for each query. It is particularly useful for binary relevance tasks. `` ****Output:**** ``` 0: learn: 0.1000000 test: 0.0800000 best: 0.0800000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.1200000 test: 0.0900000 best: 0.0900000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.7000000 test: 0.6500000 best: 0.6500000 (999) total: 1m 40s remaining: 0usbestTest = 0.6500000 ``` ## Advanced Ranking Modes: YetiRankPairwise YetiRankPairwise is an advanced ranking mode that optimizes specific ranking loss functions by specifying the `mode` parameter. It supports various loss functions like `DCG`, `NDCG`, `MRR`, `ERR`, and `MAP`. ****Parameters:**** - ****Mode****: Can be `Classic` or a specific ranking loss function. - ****Number of permutations****: Default is 10. - ****Probability of search continuation****: Default is 0.85. `` ****Output:**** ``` 0: learn: 0.5000000 test: 0.4500000 best: 0.4500000 (0) total: 0.1s remaining: 1m 40s 1: learn: 0.5200000 test: 0.4600000 best: 0.4600000 (1) total: 0.2s remaining: 1m 40s ... 999: learn: 0.9500000 test: 0.9000000 best: 0.9000000 (999) total: 1m 40s remaining: 0usbestTest = 0.9000000 ``` For large datasets, it is recommended to use `YetiRankPairwise` or `PairLogitPairwise` as they provide more accurate results but may take longer to train. Additionally, metrics like `PFound` and `NDCG` can be calculated during training to monitor the model's performance. ## Choosing the Right Ranking Metric The best metric for your task depends on your specific needs. Here are some factors to consider: - ****Relevance vs. Position:**** If precise ranking of highly relevant items is crucial, NDCG or MAP might be better choices. - ****Number of Relevant Items:**** For scenarios with a high number of relevant items, HR might be more informative. - ****Business Goals:**** Align the metric with your business objectives. For example, if click-through rate is essential, consider incorporating user interaction data into a custom metric. ## Conclusion CatBoost offers a comprehensive set of ranking metrics and modes that cater to various ranking tasks. By leveraging these metrics, data scientists can build robust and high-performing ranking models. Whether you are working on search engines, recommendation systems, or any other ranking application, CatBoost's ranking capabilities provide the tools needed to achieve optimal results.
Shard103 (laksa)
Root Hash12046344915360636903
Unparsed URLorg,geeksforgeeks!www,/machine-learning/catboost-ranking-metrics-a-comprehensive-guide/ s443