LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

LightGBM - #392

Merged
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm
Jun 26, 2018
Merged

LightGBM #392
codemzs merged 14 commits into
dotnet:masterfrom
codemzs:lightgbm

Conversation

@codemzs

Copy link
Copy Markdown
Member

LightGBM integration. This change adds API for LightGBM binary and multiclass classifier.

fixes#391

@TomFinley

TomFinley commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

This is pretty fantastic @codemzs, and I see the test even on Mac is working! That's great. #Closed

Comment threadbuild.sh Outdated
set -e

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mac OS X platform [](start = 5, length = 17)

Very minor note, I think they've deprecated the name "Mac OS X" in favor of "macOS". #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

What happens with this, if Homebrew is already installed? Homebrew is pretty popular -- I expect the proportion of people on Mac that are trying to build us that also already have homebrew to be pretty high.

Now, let's consider the set of people that do not have it installed. The potential installation of a package management system on someone's machine as part of the simple build system, I wonder if that's perhaps going a bit too far. This is actually changing the user's system... and indeed with this yes command we've actually explicitly taken away that choice. This concerns me. #Resolved

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be added to the machine setup doc instead. We shouldn’t be installing things during the build scripts. #Resolved

[TestCategory("LightGBM")]
public void LightGBMClassificationTest()
{
RunMTAThread(() =>

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RunMTAThread [](start = 12, length = 12)

What is the purpose of this? #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Helper to create a background thread and wait for it to finish.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. What I mean is, what is the purpose of your call of it? I was not asking what the method does. I am asking why you are calling it. What goes wrong if you just run it in the current thread?


In reply to: 197570408 [](ancestors = 197570408,197461317)

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We could do that but I think this function also catches any exception thrown by the test and using this function to run tests seems to be the pattern.


In reply to: 197575746 [](ancestors = 197575746,197570408,197461317)

[Fact]
[TestCategory("Binary")]
[TestCategory("LightGBM")]
public void LightGBMClassificationTest()

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGBMClassificationTest [](start = 20, length = 26)

Should we port over more tests? I'm pretty sure we had more than this in the repo we're migrating from. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can try but my concern is some of them might depend on datasets that we may not have in this repo for legal reasons.


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. That seems like a very valid concern, but rather than leaving the code untested, should we not write tests for things like regression, ranking, multiclass that we currently are using for the other tests that exist in ML.NET?


In reply to: 197570510 [](ancestors = 197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We certainly should and I'm going to try. If the dataset is not available I will try to use an existing one and change the pipeline.


In reply to: 197575933 [](ancestors = 197575933,197570510,197461623)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Got everything except ranking for which we need to find a new dataset. I will open an issue and skip the test for ranking. I did swap housing dataset for wine for regression tests.


In reply to: 197577162 [](ancestors = 197577162,197575933,197570510,197461623)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@eerhardteerhardtJun 22, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You’ll need to add a new nupkg project for this. Not all users will need/want LightGBM, so we shouldn’t require everyone to depend on/deploy it. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Can you please clarify? My understanding is LightGBM will always be part of ML.NET


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

@TomFinleyTomFinleyJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part of ML.NET, but in a separate nuget so those that don't need it don't get it. There would be the ML.NET nuget containing the core components... but then also and the ML.NET LightGBM nuget, the ML.NET OnnxExport nuget, the ML.NET FastTree nuget, the ML.NET CNTK nuget, the ML.NET torch nuget, etc.


In reply to: 197566747 [](ancestors = 197566747,197500282)

</ItemGroup>

<ItemGroup>
<PackageReference Include="LightGBM" Version="2.1.2.2" />

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2.1.2.2 [](start = 50, length = 7)

should we put this into build\Dependencies.props ? #Resolved

using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.LightGBM;
using System.Collections.Generic;

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

order #Resolved


namespace Trainers
{
public enum LightGbmArgumentsEvalMetricType

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LightGbmArgumentsEvalMetricType [](start = 20, length = 31)

No changes in core-ep.json? #Pending

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

apparently not but should investigate why


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

public double RegAlpha = 0;

[Argument(ArgumentType.AtMostOnce,
HelpText = "Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases).")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you break this sentence into two lines? it's super long #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" [](start = 1, length = 104)

Can we have comment why we doing this?
I would assume this is LightGBM dependency, but I would prefer to make this statement here, instead of going through file history #Resolved


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"gbdt" [](start = 40, length = 6)

We use it 3 times, any chance you want to make it public const string? Same for FriendlyName, accross all boosters #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmBinaryClassifier", Desc = "Train an LightGBM binary class model", UserName = LightGbmBinaryTrainer.Summary, ShortName = LightGbmBinaryTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

long line, can we split it? #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.BinaryClassificationOutput>(host, input,
() => new LightGbmBinaryTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn) [](start = 16, length = 104)

LightGbmArguments is LearnerInputBaseWithGroupId, but we don't pass getGroup function... #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Not sure what you mean but this is really a port of LightGBM so please keep comments within the scope of the PR>


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

public const string RegistrationName = "LightGBMBinaryPredictor";
private static VersionInfo GetVersionInfo()
{
// REVIEW tfinley(guoke): can we decouple the version from FastTree predictor version ?

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tfinley(guoke) [](start = 22, length = 14)

clean review comments from internal aliases #Resolved

/// </summary>
public static partial class LightGbm
{
[TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = LightGbmMulticlassTrainer.ShortName)]

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 [TlcModule.EntryPoint(Name = "Trainers.LightGbmClassifier", Desc = "Train an LightGBM multi class model", UserName = LightGbmMulticlassTrainer.Summary, ShortName = [](start = 0, length = 172)

really long lane #Resolved

return LearnerEntryPointsUtils.Train<LightGbmArguments, CommonOutputs.MulticlassClassificationOutput>(host, input,
() => new LightGbmMulticlassTrainer(host, input),
getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getWeight [](start = 16, length = 9)

add getGroup: #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure if there is a need to.


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

public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, LightGbmArguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainLightGBM");

@Ivanidzo4kaIvanidzo4kaJun 22, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TrainLightGBM [](start = 37, length = 13)

would be nice to have specific to kind channel, other than same string across all 4 trainers. #WontFix

</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The AllowUnsafeBlocks property can be moved into the unconditional PropertyGroup above. It keeps the .csproj simple. #Resolved

{
double*[] ptrArrayValues = new double*[numCol];
int*[] ptrArrayIndices = new int*[numCol];
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There appears to be a few misuses of Parallel.For in this code.

Usually if the operation inside the loop is very small, the overhead of doing the Thread management and communication outweighs any parallel savings. In this case, it is over 2x slower using Parallel.For than just a simple for loop. I write a simple benchmark of the two: https://gist.github.com/eerhardt/99071a3b6b00ddfe5ae02d9f85d4f9d6.

Results:

BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.300
[Host] : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
DefaultJob : .NET Core 2.1.0 (CoreCLR 4.6.26515.07, CoreFX 4.6.26515.06), 64bit RyuJIT
MethodMeanErrorStdDev
Original62.12 us1.2207 us1.199 us
NoParallel27.06 us0.5554 us1.196 us

@codemzscodemzsJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is great! Thank you @eerhardt for going an extra mile to validate parallel for loop.


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

}
finally
{
Parallel.For(0, numCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This use of Parallel.For should probably be removed. #Resolved

int[] nonZeroCntPerColumn = new int[catMetaData.NumCol];
int estimateNonZeroCnt = (int)(numSampleRow * density);
estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt);
Parallel.For(0, catMetaData.NumCol, i =>

@eerhardteerhardtJun 25, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's another case where Parallel.For is probably slowing the operation down. #Resolved

Comment threadbuild.sh Outdated

if [ "$(uname)" == "Darwin" ]; then
#Mac OS X platform
yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

@TomFinleyTomFinleyJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[](start = 0, length = 1)

Consistency with tabs spaces, and general indentation. Note that below you have two spaces for indentation. Here you have either four spaces (on one of the new lines) or one tab (on two of the new lines). #Resolved

var leafOutput = Str2DoubleArray(kvPairs["leaf_value"], ' ');
if (leafOutput[0] != 0)
{
// Convert Constant tree to Two-leaf tree, avoid being filter by TLC.

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TLC [](start = 93, length = 3)

another mention of this. #Resolved

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There are plenty of mentions of TLC across ML.NET codebase and we should open a separate PR and address this issue.


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

@glebuk

glebuk commented Jun 25, 2018

Copy link
Copy Markdown
Contributor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

TLC - should we update throughout? #WontFix


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)


public sealed class TreeBooster : BoosterParameter<TreeBooster.Arguments>
{
[TlcModule.Component(Name = "gbdt", FriendlyName = "Tree Booster", Desc = "Traditional Gradient Boosting Decision Tree.")]

@glebukglebukJun 25, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TlcModule [](start = 13, length = 9)

Another vestigial name, perhaps rename in different PR. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor
 [Fact(Skip = "Need CoreTLC specific baseline update")]

Sure but it would be its own change. It is not in the scope of this change which is merely porting LGBM to ML.NET.


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


Refers to: test/Microsoft.ML.Predictor.Tests/TestPredictors.cs:101 in f35aee4. [](commit_id = f35aee4, deletion_comment = False)

[TestCategory("EntryPoints")]
public void TestLearn()
{
//Skip this test for macOS until engineering system installs OpenMP dependency for

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my experience, it is best to log an issue for things like this, and then add a link to the issue in the code. That way we can track removing it.
And when someone stumbles across this test being disabled, they can go find out the status by looking at the issue. #Resolved

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codemzsmentioned at the end of yesterday he would, so he probably will today. #Resolved

@codemzscodemzsJun 26, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done. Refer to #417 #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks sir


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

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />

@eerhardteerhardtJun 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does LightGBM have a dependency on FastTree? #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As you might imagine, there were a number of existing facilities for FastTree predictors (both in this code, and elsewhere). So when Goulin and Taifeng were first coming up with this, they chose to actually return an actual FastTree predictor, rather than invent their own. The shared format between the two learners has many benefits, but it does result in this dependency unfortunately. A cleaner solution might have been to factor out the code so that it is outside the FastTree project, but that code is so awful (still 99% of it in its original MSR state) that possibly they found this a daunting prospect. (Certainly I would. :) )


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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That is right, the predictor is shared between FastTree and LightGBM, refer to regressiontree.cs in FastTree project.


In reply to: 198213703 [](ancestors = 198213703,198167265)

using Xunit;
using Xunit.Abstractions;
using System.Runtime.InteropServices;

@TomFinleyTomFinleyJun 26, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep sorted if you don't mind. #Resolved

@codemzscodemzs mentioned this pull request Jun 26, 2018

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general infrastructure changes look good from my side.

@codemzs
codemzs merged commit 0a349f8 into dotnet:masterJun 26, 2018
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 20:50
@codemzs
codemzs restored the lightgbm branch June 26, 2018 22:08
@codemzs
codemzs deleted the lightgbm branch June 26, 2018 22:14
eerhardt pushed a commit that referenced this pull request Jun 27, 2018
* Bump master to v0.3 (#269)
* RocketEngine fix for selecting top learners (#270)
* Changes to RocketEngine to fix take top k logic.
* Add namespace information to allow file to reference correct version of Formatting object.
* small code cleanup (#271)
* Preparation for syncing sources with internal repo (#275)
* make class partial so I can add constuctor in separate file. add constructros for testing
* formatting
* Changes to use evaluator metrics names in PipelineSweeperSupportedMetrics. Made the private const strings in two classes public. (#276)
* add missing subcomponents to sweepers (#278)
* add missing subcomponents
* right one
* more cleanup
* remove lotus references. (#252)
* Random seed and concurrency for tests (#277)
* first attempt
* add comments
* specify seed for random.
make constructor internal.
* Fix SupportedMetric.ByName() method (#280)
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Fix for SupportedMetric.ByName() method. Include new unit test for function.
* Removed unnecessary field filter, per review comment.
* ML.NET-242: FastTreeRanking per-iteration loss metrics are empty (#289)
When training a FastTreeRanker using the `testFrequency` parameter, it is expected that NDCG is prented every testFrequency iterations. However, instead of NDCG, only empty strings are printed.
The root cause was that the MaxDCG property of the dataset was never calculated, so the NDCG calculation is aborted, leaving an empty string as a result.
This PR fixes the problem by computing the MaxDCG for the dataset when the Tests are defined (so that if the tests are not defined, the MaxDCG will never be calculated).
Closes#242
* Fixed typo in the method summary (#296)
* Remove stale line of code from test. (#297)
* Update release notes link to use aka.ms. (#294)
Our release notes link is broken because the `Documentation` was renamed to `docs`. Fix this for the future to use a redirection link.
* Add release notes for ML.NET 0.2 (#301)
* Add release notes for ML.NET 0.2
* Adding release note about TextLoader changes and additional issue/PR references
* Addressing comments: fixing typos, changing formatting, and adding references
* Get the cross validation macro to work with non-default column names (#291)
* Add label/grou/weight column name arguments to CV and train-test macros
* Fix unit test.
* Merge.
* Update CSharp API.
* Fix EntryPointCatalog test.
* Address PR comments.
* update sample in README.MD with 0.2 features. (#304)
* update sample with new text loader API.
* update with 0.2 stuff.
* OVA should respect normalization in underlying learner (#310)
* Respect normalization in OVA.
* some cleanup
* fix copypaste issues
* Export to ONNX and cross-platform command-line tool to script ML.NET training and inference (#248)
* Export to ONNX and Maml cross-platform executable.
* Add Cluster evaluator (#316)
* Add Cluster evaluator
* fix copypaste
* address comments
* formatting
* Fixes locale dependent test output comparisons (#109)
The tests do not pass on systems with locale other than en-US.
The error happens since the results are written to files and the
contents of the files are compared to set of correct results produced
under en-US locale.
The fix is to imbue en-US culture to the test thread so that results
will be output in format that is comparable with the test format.
This patch fixes only tests, but do not guarantee calculation will be
correct in production systems using a locale different than en-US. In
particular, there can be problems in reading data and then conversing
data from characters to numeric format.
Fixes#74
* Add PartitionedFileLoader (#61)
* Remove unexisting project from solution (#335)
* GetSummaryDataView/Row implementation for Pca and Linear Predictors (#185)
* Implement `ICanGetSummaryAsIDataView` on `PcaPredictor` class
* Implement `ICanGetSummaryAsIRow` on `LinearPredictor` class
* Disable ordinary least squares by removing the entry point (#286)
* Disable ols by temporarily removing the entry point. It may be added again once we figure out how to ship MKL as part of this project.
* add append function to pipeline (#284)
Add `Append` function to pipeline for more fluent API than that allowed by `Add`
* Removed field/column name checking of input type in TextLoader. (#327)
* fix namespace issue in CSharpGenerator and some refactoring (#339)
fix namespace issue and refactoring
* Using named-tuple in OneToOneTransforms' constructor to make API more readable. (#324)
* Minor formatting in CollectionDataSourceTests.cs (#348)
* Create CalibratedPredictor instead of SchemaBindableCalibratedPredictor (#338)
`CalibratorUtils.TrainCalibrator` and `TrainCalibratorIfNeeded` now creates `CalibratedPredictor` instead of `SchemaBindableCalibratedPredictor` whenever the predictor implements `IValueMapper`.
* Remove reference and dependency on System.ValueTuple (#351)
* Add link to samples (#355)
* Use HideEnumValueAttribute for both manifest and C# API generation. (#356)
* Use HideEnumValueAttribute for both manifest and C# API generation.
* Unhide NAReplaceTransform.ReplacementKind.SpecifiedValue. This may require some other PR to resolve the corresponding issues.
* Move the NuGet package build files into a TFM specific directory. (#370)
When installing Microsoft.ML on an unsupported framework (like net452), it is currently getting installed successfully. However, users should be getting an error stating that net452 is not supported by this package.
The cause is the build files exist for any TFM, which NuGet interprets as this package supports any TFM. Moving the build files to be consistent with the 'lib' folder support.
Fix#357
* `Stream` subclasses now have `Close` call `base.Close` to ensure disposal. (#369)
* Subclasses of `Stream` now have `Close` call `base.Close` to ensure disposal.
* Add DeleteOnClose to File opening.
* Remove explicit delete of file.
* Remove explicit close of substream.
* Since no longer deleting explicitly, no longer need `_overflowPath` member.
* Return distinct array of ParameterSet when ProposeSweep is called (#368)
* Changed List to HashSet to ensure that there are no duplicates
* Update fast tree argument help text (#372)
* Update fast tree argument help text
* Update wording
* Update API to fix test
* Update core manifest JSON to update help text
* Combine multiple tree ensemble models into a single tree ensemble (#364)
* Add a way to create a single tree ensemble model from multiple tree ensemble models.
* Address PR comments, and fix bugs in serializing/deserializing RegressionTrees.
* Address PR comments.
* add pipelineitem for Ova (#363)
add pipelineitem for Ova
* Fix CV macro to output the warnings data view properly. (#385)
* Link to an example on using converting ML.NET model to ONNX. (#386)
* Adding documentation about entry points, and entry points graphs: EntryPoints.md and GraphRunner.md (#295)
* Adding EntryPoints.md and GraphRunner.md
* addressing PR feedback
* Updating the title of the GraphRunner.md file
* adressing Tom's feedback
* adressing feedback
* code formatting for class names
* Addressing Gal's comments
* Adding an example of an entry point. Fixing casing on ML.NET
* fixing link
* Adding LDA Transform (#377)
* Revert to using the native code (#413)
Corrects an unintentional "typo" in FastTreeRanking.cs where there was mistakenly a USE_FASTTREENATIVE2 instead of USE_FASTTREENATIVE. This resulted in some obscure hidden ranking options (distance weighting, normalize query lambdas, and a few others) being unavailable. These are important for some applications.
* LightGBM (#392)
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
* Adding Factorization Machines (#383)
* Adding Factorization Machines
* ONNX API documentation. (#419)
* ONNX API documentation.
* Bring ensembles into codebase (#379)
Introduce Ensemble codebase
* enable macOS tests for LightGBM. (#422)
* Create a shorter temp file name for model loading. (#397)
Create a shorter temp file name for model loading, as well as remove the potential for a race condition among multiple openings by using the creation of a lock file.
* removing extraneous character that broke the linux build, and with it unecessary cmake version requirement (#425)
* EvaluatorUtils to handle label column of type key without text key values (#394)
* Fix EvaluatorUtils to handle label column of type key without text key values.
* Removing non source files from solution (#362)
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
* LightGBM and test.
* add test baselines and nuget source for lightGBM binaries.
* Add entrypoint for lightGBM.
* add unsafe flag for release build.
* update nuget version.
* make lightgbm test single threaded.
* install gcc on OS machines to resolve dependencies on openmp thatis needed by lightgbm native code.
* PR comments. Leave BREW and GCC in bash script to verify macOS tests work.
* remove brew and gcc from build script.
* PR feedback.
* disable test on macOS.
* disable test on macOS.
* PR feedback.
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port LightGBM

6 participants

@codemzs@TomFinley@glebuk@Ivanidzo4ka@eerhardt@StrikerRUS