From 9e737a892676d71251a95e97afda67b6d8d59fa3 Mon Sep 17 00:00:00 2001 From: Rogan Carr Date: Fri, 1 Jun 2018 15:01:44 -0700 Subject: [PATCH] ML.NET-242: FastTreeRanking per-iteration loss metrics are empty 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 --- src/Microsoft.ML.FastTree/FastTreeRanking.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index 7f89858e008..cf17a0d2bee 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -343,6 +343,9 @@ protected override void CustomizedTrainingIteration(RegressionTree tree) /// standard test for the dataset private Test CreateStandardTest(Dataset dataset) { + if (dataset.MaxDcg.Length == 0) + dataset.Skeleton.RecomputeMaxDcg(10); + return new NdcgTest( ConstructScoreTracker(dataset), dataset.Ratings,