Skip to content

Cleaning and Fixing public API for set of learners. #2765

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 21 commits into from
Mar 2, 2019

Conversation

zeahmed
Copy link
Contributor

@zeahmed zeahmed commented Feb 27, 2019

This PR partially addressed #2620

The following learners are addressed in this PR.

  • MatrixFactorizationTrainer
  • PriorTrainer
  • RandomTrainer
  • SymSgdClassificationTrainer

the following tasks were performed in classes related to above learners.

  • Checking to make sure that unnecessary public methods/properties be internal.
  • Renaming parameters according to standard.
  • Creating/Refactoring samples according to standards.

@codecov
Copy link

codecov bot commented Feb 27, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@49a96c5). Click here to learn what that means.
The diff coverage is 88.88%.

@@            Coverage Diff            @@
##             master    #2765   +/-   ##
=========================================
  Coverage          ?   71.68%           
=========================================
  Files             ?      808           
  Lines             ?   142392           
  Branches          ?    16112           
=========================================
  Hits              ?   102074           
  Misses            ?    35888           
  Partials          ?     4430
Flag Coverage Δ
#Debug 71.68% <88.88%> (?)
#production 67.93% <80%> (?)
#test 85.86% <100%> (?)
Impacted Files Coverage Δ
...oft.ML.StandardLearners/StandardLearnersCatalog.cs 88.63% <ø> (ø)
...StandardLearners/Standard/Simple/SimpleTrainers.cs 77.96% <ø> (ø)
...t.ML.HalLearners/ComputeLRTrainingStdThroughHal.cs 92.85% <ø> (ø)
...osoft.ML.Recommender/MatrixFactorizationTrainer.cs 70.39% <ø> (ø)
...oft.ML.Recommender/MatrixFactorizationPredictor.cs 86.21% <ø> (ø)
...rc/Microsoft.ML.HalLearners/OlsLinearRegression.cs 66.3% <0%> (ø)
...sts/TrainerEstimators/SymSgdClassificationTests.cs 100% <100%> (ø)
...est/Microsoft.ML.Predictor.Tests/TestPredictors.cs 63.84% <100%> (ø)
src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs 94.28% <100%> (ø)
...ests/TrainerEstimators/OlsLinearRegressionTests.cs 100% <100%> (ø)
... and 3 more

@@ -223,7 +223,7 @@ private protected override BinaryPredictionTransformer<TPredictor> MakeTransform
=> new BinaryPredictionTransformer<TPredictor>(Host, model, trainSchema, FeatureColumn.Name);

/// <summary>
/// Continues the training of a <see cref="SymSgdClassificationTrainer"/> using an already trained <paramref name="modelParameters"/>
/// Continues the training of a <see cref="SymbolicStochasticGradientDescentClassificationTrainer"/> using an already trained <paramref name="modelParameters"/>
/// a <see cref="BinaryPredictionTransformer"/>.
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 27, 2019

Choose a reason for hiding this comment

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

what a means in this sentence? #Resolved

///<summary> The rank of the factor matrices.</summary>
public readonly int ApproximationRank;
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 28, 2019

Choose a reason for hiding this comment

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

ApproximationRank [](start = 28, length = 17)

I'm not sure this one is any way better than previous code. Now you need to initialize new variable. #Resolved

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Feb 28, 2019

    public static OlsLinearRegressionTrainer OrdinaryLeastSquares(this RegressionCatalog.RegressionTrainers catalog,

OrdinaryLeastSquaresRegressionTrainer? #Resolved


Refers to: src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs:30 in 8235b0a. [](commit_id = 8235b0a, deletion_comment = False)

// Define the columns to load
var loader = mlContext.Data.CreateTextLoader(
// Define the columns to read
var reader = mlContext.Data.CreateTextLoader(
Copy link
Member

@sfilipi sfilipi Mar 1, 2019

Choose a reason for hiding this comment

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

reader [](start = 16, length = 6)

nit: if the Name is CreateTextLoader let;s stick with Load. #Resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

Still reader.


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

Copy link
Member

@sfilipi sfilipi left a comment

Choose a reason for hiding this comment

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

:shipit:

var loader = mlContext.Data.CreateTextLoader(
// Step 1: Read the data as an IDataView.
// First, we define the reader: specify the data columns and where to find them in the text file.
var reader = mlContext.Data.CreateTextLoader(
Copy link
Member

@sfilipi sfilipi Mar 1, 2019

Choose a reason for hiding this comment

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

reader [](start = 16, length = 6)

load. Artidoro had a whole PR to replace Read with Load.
#Resolved


// Step 2: Pipeline
// Featurize the text column through the FeaturizeText API.
// Then append a binary classifier, setting the "Label" column as the label of the dataset, and
// the "Features" column produced by FeaturizeText as the features column.
var pipeline = mlContext.Transforms.Text.FeaturizeText("Features", "SentimentText")
.AppendCacheCheckpoint(mlContext) // Add a data-cache step within a pipeline.
Copy link
Member

@sfilipi sfilipi Mar 1, 2019

Choose a reason for hiding this comment

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

// Add a data-cache step within a pipeline. [](start = 54, length = 43)

why remove it? #Resolved

// Split it between training and test data
var trainTestData = mlContext.BinaryClassification.TrainTestSplit(data);
// Read the data
var trainData = reader.Load(trainFile);
Copy link
Member

@sfilipi sfilipi Mar 1, 2019

Choose a reason for hiding this comment

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

reader.Load [](start = 28, length = 11)

nit.: revert #Resolved

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Mar 1, 2019

        public float L2Weight = 1e-6f;

See my comments in your other PR which also touch OLS.
I'm fine with pushing this one first, just make sure you address comments in other PR. #Resolved


Refers to: src/Microsoft.ML.HalLearners/OlsLinearRegression.cs:50 in 88a14c4. [](commit_id = 88a14c4, deletion_comment = False)

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

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

:shipit:

@zeahmed
Copy link
Contributor Author

zeahmed commented Mar 1, 2019

        public float L2Weight = 1e-6f;

OK, I will fix that in the other PR. I will have to merge it with the other one anyways.


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


Refers to: src/Microsoft.ML.HalLearners/OlsLinearRegression.cs:50 in 88a14c4. [](commit_id = 88a14c4, deletion_comment = False)

@zeahmed zeahmed merged commit 1942c8f into dotnet:master Mar 2, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 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.

3 participants