Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing scenerio 3 of issue #3995 #4214

Merged
merged 2 commits into from
Sep 17, 2019
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.") ;
Copy link

@yaeldekel yaeldekel Sep 15, 2019

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

Copy link
Contributor Author

@Lynx1820 Lynx1820 Sep 16, 2019

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