-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Respect group id in options for ranking task #2742
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,8 @@ private protected LightGbmTrainerBase(IHostEnvironment env, | |
} | ||
|
||
private protected LightGbmTrainerBase(IHostEnvironment env, string name, Options options, SchemaShape.Column label) | ||
: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn)) | ||
: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, | ||
TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn), TrainerUtils.MakeU4ScalarColumn(options.GroupIdColumn)) | ||
{ | ||
Host.CheckValue(options, nameof(options)); | ||
|
||
|
@@ -163,7 +164,7 @@ private protected virtual void CheckDataValid(IChannel ch, RoleMappedData data) | |
ch.CheckParam(data.Schema.Label.HasValue, nameof(data), "Need a label column"); | ||
} | ||
|
||
protected virtual void GetDefaultParameters(IChannel ch, int numRow, bool hasCategarical, int totalCats, bool hiddenMsg=false) | ||
protected virtual void GetDefaultParameters(IChannel ch, int numRow, bool hasCategarical, int totalCats, bool hiddenMsg = false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
for the sake of not having short names -hiddenMessage? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll leave that stuff to whoever would scrub lightgbm learners. |
||
{ | ||
double learningRate = LightGbmTrainerOptions.LearningRate ?? DefaultLearningRate(numRow, hasCategarical, totalCats); | ||
int numLeaves = LightGbmTrainerOptions.NumLeaves ?? DefaultNumLeaves(numRow, hasCategarical, totalCats); | ||
|
@@ -584,7 +585,7 @@ private void CreateDatasetFromSamplingData(IChannel ch, FloatLabelCursor.Factory | |
int[] nonZeroCntPerColumn = new int[catMetaData.NumCol]; | ||
int estimateNonZeroCnt = (int)(numSampleRow * density); | ||
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt); | ||
for(int i = 0; i < catMetaData.NumCol; i++) | ||
for (int i = 0; i < catMetaData.NumCol; i++) | ||
{ | ||
nonZeroCntPerColumn[i] = 0; | ||
sampleValuePerColumn[i] = new double[estimateNonZeroCnt]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,8 @@ public void FastTreeRankerEstimator() | |
new FastTreeRankingTrainer.Options | ||
{ | ||
FeatureColumn = "NumericFeatures", | ||
NumTrees = 10 | ||
NumTrees = 10, | ||
GroupIdColumn = "Group" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I feel like this should be "GroupColumn" to fall more inline with FeatureColumn and LabelColumn. |
||
}); | ||
|
||
var pipeWithTrainer = pipe.Append(trainer); | ||
|
@@ -134,7 +135,7 @@ public void LightGBMRankerEstimator() | |
{ | ||
var (pipe, dataView) = GetRankingPipeline(); | ||
|
||
var trainer = ML.Ranking.Trainers.LightGbm(labelColumnName: "Label0", featureColumnName: "NumericFeatures", rowGroupColumnName: "Group", learningRate: 0.4); | ||
var trainer = ML.Ranking.Trainers.LightGbm(new Options() { LabelColumn = "Label0", FeatureColumn = "NumericFeatures", GroupIdColumn = "Group", LearningRate = 0.4 }); | ||
|
||
var pipeWithTrainer = pipe.Append(trainer); | ||
TestEstimatorCore(pipeWithTrainer, dataView); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misspelling -- should be hasCategorical.