dotnet / dotnet/machinelearning-samples
Update Ranking Sample for NDCG Truncation Level
- Dominant language
- PowerShell
- Stars
- 4.7k
- Forks
- 2.7k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Description
There's a PR out to allow the user to set the truncation level for the DCG/NDCG metics:
https://github.com/dotnet/machinelearning/pull/4081/
In our sample, we currently are using reflection to set this truncation level:
https://github.com/dotnet/machinelearning-samples/blob/f50535f048df3b6e7b41c2093b5c9027030b5359/samples/csharp/getting-started/Ranking_Web/WebRanking/Common/ConsoleHelper.cs#L32-L40
Task: We should use the public method to set the DCG/NDCG truncation level once available (after the PR).
We may also want to show off how to get the NDCG metric at multiple thresholds, similar to the TensorFlow ranking example: ([link](https://github.com/tensorflow/ranking/blob/46dfc825b3782a4b928431a499e5ff09078dca63/tensorflow_ranking/examples/tf_ranking_libsvm.ipynb))
```python
metric_fns.update({
"metric/ndcg@%d" % topn: tfr.metrics.make_ranking_metric_fn(
tfr.metrics.RankingMetricKey.NDCG, topn=topn)
for topn in [1, 3, 5, 10]
})
```
Contributor guide
Assessment
This issue has not been assessed yet.