Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.") ;

@yaeldekel yaeldekel Sep 15, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!condition)
    throw ...

is the same as doing a check on condition.
#Resolved

@kere-nel kere-nel Sep 16, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yael! Checkparam throws an ArgumentOutOfRangeException, I switched to checking manually, so I can throw a different type of exception. There's also a checkvalue function, but it only works for checking classes. #Resolved

var groupCol = data.Schema.Group.Value;
var groupType = groupCol.Type;
if (!(groupType == NumberDataViewType.UInt32 || groupType is KeyDataViewType))
Expand Down