Skip to content

Extend Gam Samples - #3281

Merged
rogancarr merged 8 commits into
dotnet:masterfrom
rogancarr:gam_samples
Apr 12, 2019
Merged

Extend Gam Samples#3281
rogancarr merged 8 commits into
dotnet:masterfrom
rogancarr:gam_samples

Conversation

@rogancarr

Copy link
Copy Markdown
Contributor

This PR extends the current GAM samples for regression and adds them for Binary Classification.

Fixes #3280

@codecov

codecov Bot commented Apr 10, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3281 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3281      +/-   ##
==========================================
+ Coverage   72.62%   72.64%   +0.01%     
==========================================
  Files         807      807              
  Lines      145080   145191     +111     
  Branches    16213    16223      +10     
==========================================
+ Hits       105368   105477     +109     
- Misses      35294    35295       +1     
- Partials     4418     4419       +1
Flag Coverage Δ
#Debug 72.64% <ø> (+0.01%) ⬆️
#production 68.17% <ø> (-0.01%) ⬇️
#test 88.97% <ø> (+0.04%) ⬆️
Impacted Files Coverage Δ
src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs 94.18% <ø> (ø) ⬆️
src/Microsoft.ML.Transforms/Text/LdaTransform.cs 89.26% <0%> (-0.63%) ⬇️
...soft.ML.TestFramework/DataPipe/TestDataPipeBase.cs 73.7% <0%> (-0.34%) ⬇️
...StandardTrainers/Standard/Simple/SimpleTrainers.cs 77.61% <0%> (-0.17%) ⬇️
src/Microsoft.ML.Recommender/RecommenderCatalog.cs 70.83% <0%> (ø) ⬆️
src/Microsoft.ML.DataView/DataViewType.cs 86.82% <0%> (ø) ⬆️
...c/Microsoft.ML.CpuMath/CpuMathUtils.netstandard.cs 93.75% <0%> (ø) ⬆️
src/Microsoft.ML.DataView/VectorType.cs 89.41% <0%> (ø) ⬆️
test/Microsoft.ML.Functional.Tests/ModelFiles.cs 96.07% <0%> (ø) ⬆️
src/Microsoft.ML.DataView/IDataView.cs 100% <0%> (ø) ⬆️
... and 5 more

Comment thread docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/Gam.cs Outdated
Comment thread docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/Gam.cs Outdated
Comment thread docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/Gam.cs Outdated
Comment thread docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/Gam.cs Outdated
wschin and others added 2 commits April 11, 2019 10:46
…ification/Gam.cs

Co-Authored-By: rogancarr <rogan.carr@hotmail.com>
…ification/Gam.cs

Co-Authored-By: rogancarr <rogan.carr@hotmail.com>
@@ -0,0 +1,150 @@
using System;

@wschin wschin Apr 11, 2019

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.

Similar comments for Gam without Options apply here (and other sample files) #Resolved

wschin and others added 2 commits April 11, 2019 10:46
…ification/Gam.cs

Co-Authored-By: rogancarr <rogan.carr@hotmail.com>
…ification/Gam.cs

Co-Authored-By: rogancarr <rogan.carr@hotmail.com>

@wschin wschin 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.

Just leave some clarification comments. Overall LGTM.

else if (x < 0.25)
return 1;
else
return 0;

@shmoradims shmoradims Apr 12, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 [](start = 23, length = 1)

is this the same as x < 0 value? #Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That is correct.


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

{
// Generate random, uncoupled features.
var data = new Data {
Features = new float[2] { (float)(rng.NextDouble() - 0.5), (float)(rng.NextDouble() - 0.5) }

@shmoradims shmoradims Apr 12, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(float)(rng.NextDouble() - 0.5) [](start = 46, length = 31)

i would define this as a lambda below rng definition to make the code cleaner.

var rndFloat => (float)(rng.NextDouble() - 0.5) #Resolved

// at least the default number of bins, as a small number of bins limits the capacity of
// the model.
var trainer = mlContext.BinaryClassification.Trainers.Gam(
new GamBinaryTrainer.Options { MaximumBinCountPerFeature = 16 });

@shmoradims shmoradims Apr 12, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ptions { MaximumBinCountPerFeature = 16 } [](start = 38, length = 41)

can we use some options that are only available through Options class? #Resolved

@shmoradims shmoradims left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

@rogancarr
rogancarr merged commit e37e5b1 into dotnet:master Apr 12, 2019
@rogancarr
rogancarr deleted the gam_samples branch April 12, 2019 21:47
rogancarr added a commit to rogancarr/machinelearning that referenced this pull request Apr 12, 2019
* Adding Regression and Binary Classification GAM samples.

(cherry picked from commit e37e5b1)
@ghost ghost locked as resolved and limited conversation to collaborators Mar 22, 2022
Sign up for free to 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.

Samples for GAM are needed

3 participants