Skip to content

Commit 79a437e

Browse files
author
Rogan Carr
committed
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
1 parent 465b123 commit 79a437e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Microsoft.ML.FastTree/FastTreeRanking.cs

+3
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ protected override void CustomizedTrainingIteration(RegressionTree tree)
343343
/// <returns>standard test for the dataset</returns>
344344
private Test CreateStandardTest(Dataset dataset)
345345
{
346+
if (Utils.Size(dataset.MaxDcg) == 0)
347+
dataset.Skeleton.RecomputeMaxDcg(10);
348+
346349
return new NdcgTest(
347350
ConstructScoreTracker(dataset),
348351
dataset.Ratings,

0 commit comments

Comments
 (0)