Skip to content

Commit

Permalink
ML.NET-242: FastTreeRanking per-iteration loss metrics are empty
Browse files Browse the repository at this point in the history
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.

The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.

This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).

Closes #242
  • Loading branch information
Rogan Carr committed Jun 1, 2018
1 parent 465b123 commit 9e737a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Microsoft.ML.FastTree/FastTreeRanking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ protected override void CustomizedTrainingIteration(RegressionTree tree)
/// <returns>standard test for the dataset</returns>
private Test CreateStandardTest(Dataset dataset)
{
if (dataset.MaxDcg.Length == 0)
dataset.Skeleton.RecomputeMaxDcg(10);

return new NdcgTest(
ConstructScoreTracker(dataset),
dataset.Ratings,
Expand Down

0 comments on commit 9e737a8

Please sign in to comment.