diff --git a/src/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs b/src/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs index 12cc0b148e..8ed23778e9 100644 --- a/src/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs +++ b/src/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs @@ -222,7 +222,8 @@ private protected override void CheckDataValid(IChannel ch, RoleMappedData data) $"Label column '{labelCol.Name}' is of type '{labelType.RawType}', but must be Key or Single."); } // Check group types. - ch.CheckParam(data.Schema.Group.HasValue, nameof(data), "Need a group column."); + if(!data.Schema.Group.HasValue) + throw ch.ExceptValue(nameof(data.Schema.Group), "Group column is missing.") ; var groupCol = data.Schema.Group.Value; var groupType = groupCol.Type; if (!(groupType == NumberDataViewType.UInt32 || groupType is KeyDataViewType))