Member-only story
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…