Skip to content

NDCG tutorial notebook#94

Open
steaphenai wants to merge 2 commits intopytorch-ignite:mainfrom
steaphenai:NDCG-Metric-Tutorial
Open

NDCG tutorial notebook#94
steaphenai wants to merge 2 commits intopytorch-ignite:mainfrom
steaphenai:NDCG-Metric-Tutorial

Conversation

@steaphenai
Copy link

Docs: #93

Description

This PR adds the step-by-step Jupyter notebook tutorial for the NDCG metric.

It creates the ndcg-metric-tutorial.ipynb file in the tutorials/intermediate/ directory, as discussed with @vfdev-5. This notebook demonstrates how to effectively use the metric for ranking evaluations and will serve as the destination link for the docstring update in the main pytorch-ignite repository.

Type of Change

  • New tutorial / documentation

Checklist

  • The Jupyter notebook runs successfully from top to bottom without errors.

@aaishwarymishra
Copy link

@steaphenai
I think we should make a function for calculating the dcg score.

For the case for calculating the ideal dcg we can just call the function and send y_true in both parameters, true labels and predicted like
dcg(y_true, y_true, k)

It wll have 2 benefits:

  1. No repeated code.
  2. User just needs to understand the dcg function once.

currently you are writing 2 loops for doing same thing twice, and the loop style in both case is different .

@steaphenai
Copy link
Author

@steaphenai I think we should make a function for calculating the dcg score.

For the case for calculating the ideal dcg we can just call the function and send y_true in both parameters, true labels and predicted like dcg(y_true, y_true, k)

It wll have 2 benefits:

  1. No repeated code.
  2. User just needs to understand the dcg function once.

currently you are writing 2 loops for doing same thing twice, and the loop style in both case is different .

Yes, I Refactored into a single compute_dcg function and call it for both DCG and IDCG and made the necessary changes. Thanks!

@aaishwarymishra
Copy link

looks fine, but I think sorting of scores could be included in dcg method itself, compute_dcg(y_true,y_pred,k) for sorting according to the y_pred, and to get ideal score compute_dcg(y_true,y_true,k), which sorts according to the y_true.

@vfdev-5 thoughts?

Other than that it looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants