Back to Portfolio
Playground Series S5E6

Predicting Optimal Fertilizers

A multi-class classification challenge predicting the top 3 most suitable fertilizer types for crops based on soil composition, environmental conditions, and agricultural context.

Competition Rank
732 / 2,650
Percentile
Top 28%
Evaluation Metric
MAP@3
Challenge
Multi-label

Problem Overview

This agricultural ML competition focused on recommending the top 3 fertilizer types for given soil and crop conditions - a practical application for precision agriculture. The challenge involved multi-label classification where the model needed to predict ranked recommendations. Features included soil nutrient levels (N, P, K), pH, moisture, temperature, crop type, and region. The evaluation metric was Mean Average Precision at 3 (MAP@3), emphasizing both accuracy and ranking quality.

Technical Approach

Key Insight

The MAP@3 metric required not just accurate predictions but proper ranking. I found that training models to output well-calibrated probabilities was more important than maximizing classification accuracy alone. Additionally, understanding agronomic principles - like how nitrogen, phosphorus, and potassium work together - enabled creating meaningful interaction features that improved recommendation quality.

Technology Stack

Python Pandas NumPy Scikit-learn XGBoost CatBoost Matplotlib Seaborn

Lessons Learned

This competition taught me about ranking problems and the importance of understanding evaluation metrics deeply. MAP@3 requires a different approach than simple classification - it's not enough to predict the right fertilizer, you need to rank the top 3 in order of suitability. This has parallels to recommendation systems in production environments.

It also reinforced that spending time understanding the domain (agriculture in this case) pays dividends in feature engineering. Even basic knowledge about soil chemistry and crop nutrition requirements led to features that significantly boosted performance.