Skip to content

RocketEngine fix for selecting top learners #270

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 4 additions & 15 deletions src/Microsoft.ML.PipelineInference/AutoMlEngines/RocketEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,10 @@ private TransformInference.SuggestedTransform[] SampleTransforms(RecipeInference
private RecipeInference.SuggestedRecipe.SuggestedLearner[] GetTopLearners(IEnumerable<PipelinePattern> history)
{
var weights = LearnerHistoryToWeights(history.ToArray(), IsMaximizingMetric);
var topKTuples = new Tuple<double, int>[_topK];

for (int i = 0; i < weights.Length; i++)
{
if (i < _topK)
topKTuples[i] = new Tuple<double, int>(weights[i], i);
else
{
for (int j = 0; j < topKTuples.Length; j++)
if (weights[i] > topKTuples[j].Item1)
topKTuples[j] = new Tuple<double, int>(weights[i], i);
Copy link
Contributor

@TomFinley TomFinley May 30, 2018

Choose a reason for hiding this comment

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

Oh geez. :) Well thanks for finding and fixing!! #ByDesign

}
}

return topKTuples.Select(t => AvailableLearners[t.Item2]).ToArray();
return weights.Select((w, i) => new { Weight = w, Index = i })
.OrderByDescending(x => x.Weight)
.Take(_topK)
.Select(t=>AvailableLearners[t.Index]).ToArray();
Copy link
Contributor

Choose a reason for hiding this comment

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

t=>Av [](start = 24, length = 5)

ctrl-k-d to keep formatting up to date and whatnot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Loading the file into Visual Studio and pressing ctrl+k+d has no effect. (I'm guessing that is already the "preferred" indentation?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Tom probably talks about t=>AvailableLearners and want it to look like t => AvailableLearners.
My VS btw put spaces, maybe setting for that on your machine is disabled.


In reply to: 191921117 [](ancestors = 191921117)

}

public override PipelinePattern[] GetNextCandidates(IEnumerable<PipelinePattern> history, int numCandidates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public static string InferDatasetFeatures(IHostEnvironment env, Arguments args)
}

if (args.PrettyPrint)
jsonString = JsonConvert.SerializeObject(features, Formatting.Indented);
jsonString = JsonConvert.SerializeObject(features, Newtonsoft.Json.Formatting.Indented);
else
jsonString = JsonConvert.SerializeObject(features);

Expand Down