Don’t Underestimate XGBoost: Four other modeling tasks different from your grandmother’s classification and regression.

You there young whippersnapper, I was alive when tabular classification and regression tasks were handled with entropy and three beers worth of XGBoost train time nothing like how good you have it today with your fancy smancy Neural Networks. What do you mean XGBoost is still used today? Wait what!? when could it do ranking, survival analysis, count prediction, and specialized loss functions?

1. Learning to Rank: Search & Recommendation Systems

Ranking models are critical for search engines, recommendation systems, and personalized feeds. XGBoost implements LambdaMART-based ranking, which optimizes ranking-specific metrics like NDCG and MAP.

1.1 Normalized Discounted Cumulative Gain (NDCG) — rank:ndcg

NDCG is used in search engines, where position matters — higher-ranked results should be more relevant.

Example: Product Search Ranking

We train an XGBoost model to rank search results based on past user interactions.

import xgboost as xgb
import numpy as np

# Simulated ranking dataset
X = np.random.rand(100, 10) # 100 queries, 10 features
y = np.random.randint(1, 5, 100) # Relevance scores (1 to 4)
group = np.array([10] * 10) # 10 queries, each with 10 results
dtrain = xgb.DMatrix(X, label=y)
dtrain.set_group(group)
# Train ranking model
params = {
"objective": "rank:ndcg",
"eval_metric": "ndcg",
"learning_rate": 0.1,
}
model = xgb.train(params, dtrain, num_boost_round=100)
# Predict rankings
preds = model.predict(dtrain)
print(preds[:10]) # Display top 10 ranking scores

1.2 Mean Average Precision (MAP) — rank:map

MAP is ideal for recommendation systems where order matters (e.g., Amazon, Netflix).

params = {
"objective": "rank:map",
"eval_metric": "map",
"learning_rate": 0.1,
}
model = xgb.train(params, dtrain, num_boost_round=100)

These ranking objectives help optimize user experience by improving search relevance and

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Writing in the World of Artificial Intelligence
Writing in the World of Artificial Intelligence

Published in Writing in the World of Artificial Intelligence

Open AI’s ChatGPT has taken over as the next invention of ‘fire’, but that is not all that’s new, stay up to date with the latest and greatest that's what we cover here.

Abish Pius
Abish Pius

Written by Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer

No responses yet

Write a response