Skip to content

Extend Gam Samples #3281

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 12, 2019
Merged

Extend Gam Samples #3281

merged 8 commits into from
Apr 12, 2019

Conversation

rogancarr
Copy link
Contributor

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

Fixes #3280

@codecov
Copy link

codecov bot commented Apr 10, 2019

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

@@ -0,0 +1,150 @@
using System;
Copy link
Member

@wschin wschin Apr 11, 2019

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

Copy link
Member

@wschin wschin left a comment

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;
Copy link

@shmoradims shmoradims Apr 12, 2019

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
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) }
Copy link

@shmoradims shmoradims Apr 12, 2019

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 });
Copy link

@shmoradims shmoradims Apr 12, 2019

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

Copy link

@shmoradims shmoradims left a comment

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