Predicting Optimal Fertilizers
Optimizing Fertilizer Recommendations with Multi-Class Ranking

The objective of this predictive modeling task is to identify the most appropriate fertilizer recommendation given a combination of structured inputs, including meteorological data, soil properties, and crop type. The problem is approached as a label-ranking task, where the model outputs a ranked list of candidate fertilizers rather than a single class prediction. This allows for flexibility in downstream decision-making, particularly in scenarios where multiple fertilizers may be viable.
To assess the quality of these ranked predictions, we employ the Mean Average Precision at 3 (MAP@3) metric. MAP@3 captures both the correctness and the ranking quality of the predictions by evaluating whether the true label appears within the top 3 predicted labels, and assigning higher credit to correct labels that appear earlier in the list. Formally, for each test instance, the Average Precision (AP) is computed based on the position of the true label in the top-3 list, and MAP@3 is the mean of these AP scores across all instances. This metric is particularly well-suited to multi-class problems with imbalanced or noisy class distributions, where providing a shortlist of highly likely candidates is more informative than enforcing a single deterministic prediction.

Where :
- U is the number of observation.
- P(k) is the precision at cutoff k
- n is the number of predictions per observation
- rel(k) is an indicator function equaling 1 if the item at rank k is a relevant (correct) label, 0 otherwise.
Results :
By combining these techniques, I was able to develop a highly predictive model that performed competitively in the leaderboard, with a well-controlled MAP@3 and strong generalization performance.
- Final Rank : 1191/2648
- RMSLE Score : 0.33473
- Best RMSLE Score : 0.38652