Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi
, '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

Fixing names of trainer estimators - #2903

Merged
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names
Mar 12, 2019
Merged

Fixing names of trainer estimators#2903
abgoswam merged 10 commits into
dotnet:masterfrom
abgoswam:abgoswam/trainerestimator_names

Conversation

@abgoswam

Copy link
Copy Markdown
Member

Fixes#2762 and #2172

@codecov

codecovBot commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2903 into master will decrease coverage by <.01%.
The diff coverage is 86.71%.

@@ Coverage Diff @@## master #2903 +/- ##
==========================================
- Coverage 71.82% 71.82% -0.01% 
==========================================
Files 812 812 Lines 142719 142719 Branches 16092 16092 ==========================================
- Hits 102513 102510 -3 - Misses 35827 35830 +3 
Partials 4379 4379
FlagCoverage Δ
#Debug71.82% <86.71%> (-0.01%)⬇️
#production67.97% <77.77%> (ø)⬆️
#test86.21% <92.63%> (-0.01%)⬇️
Impacted FilesCoverage Δ
...ers/Standard/MultiClass/PairwiseCouplingTrainer.cs90.07% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamClassification.cs89% <ø> (ø)⬆️
...L.Mkl.Components/ComputeLRTrainingStdThroughHal.cs92.85% <ø> (ø)⬆️
...rainers/Standard/MultiClass/OneVersusAllTrainer.cs74.63% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/FastTreeRegression.cs54.5% <ø> (ø)⬆️
src/Microsoft.ML.FastTree/GamRegression.cs89.09% <ø> (ø)⬆️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs72.68% <ø> (ø)⬆️
src/Microsoft.ML.LightGBM/LightGbmArguments.cs89.63% <ø> (ø)⬆️
...Microsoft.ML.Mkl.Components/OlsLinearRegression.cs66.3% <0%> (ø)⬆️
....ML.Benchmarks/KMeansAndLogisticRegressionBench.cs0% <0%> (ø)⬆️
... and 77 more

var data = mlContext.Data.LoadFromEnumerable(samples);

var options = new ML.Trainers.RandomizedPrincipalComponentAnalyzer.Options()
var options = new ML.Trainers.RandomizedPcaAnomalyDetectionTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

RandomizedPcaAnomalyDetectionTrainer [](start = 42, length = 36)

can we leave "trainer" out of the name? #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.

used acronym for Pca. Kept suffix Trainer in the name of the class


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


// Define the trainer options.
var options = new AveragedPerceptronTrainer.Options()
var options = new AveragedPerceptronBinaryClassificationTrainer.Options()

@sfilipisfilipiMar 11, 2019

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.

AveragedPerceptronBinaryClassificationTrainer [](start = 30, length = 45)

I vote for AveragePerceptron, since in this case, there aren't one for each task. #Resolved

var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
new SdcaBinaryTrainer.Options {
new StochasticDualCoordinateAscentBinaryClassificationTrainer.Options {

@sfilipisfilipiMar 11, 2019

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.

StochasticDualCoordinateAscentBinaryClassificationTrainer [](start = 42, length = 57)

StochasticDualCoordinateAscentBinaryClassification #Resolved

.Append(ml.Clustering.Trainers.KMeans(
new KMeansPlusPlusTrainer.Options
.Append(ml.Clustering.Trainers.KMeansPlusPlus(
new KMeansPlusPlusClusteringTrainer.Options

@sfilipisfilipiMar 11, 2019

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.

KMeansPlusPlusClusteringTrainer [](start = 24, length = 31)

just KMeansPlusPlus maybe #Resolved

private readonly float[] _labels;

public ObjectiveImpl(Dataset trainData, RegressionGamTrainer.Options options) :
public ObjectiveImpl(Dataset trainData, GeneralizedAdditiveModelRegressionTrainer.Options options) :

@sfilipisfilipiMar 11, 2019

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.

GeneralizedAdditiveModelRegressionTrainer [](start = 52, length = 41)

GeneralizedAdditiveModelRegression #Resolved

string outputColumnName = "Features";
var pipeline = ml.Transforms.Concatenate(outputColumnName, new[] { "Age", "Parity", "Induced" })
.Append(ml.Clustering.Trainers.KMeans(outputColumnName, numberOfClusters: 2));
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName, numberOfClusters: 2));

@wschinwschinMar 12, 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.

Suggested change
.Append(ml.Clustering.Trainers.KMeansPlusPlus(outputColumnName,numberOfClusters:2));
.Append(ml.Clustering.Trainers.KMeans(outputColumnName,numberOfClusters:2));
``` #Resolved

@abgoswamabgoswamMar 12, 2019

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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment) #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.

The algorithm that is actually implemented is KmeansPlusPlus . The underlying class is also called KMeansPlusPlus

This is also discussed here : #2762 (comment)


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

@artidoro

artidoro commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

There is also MetaMulticlassTrainer that needs to be renamed. #Resolved

@artidoro

Copy link
Copy Markdown
Contributor

This is will solve part of #2623.

@abgoswam

abgoswam commented Mar 12, 2019

Copy link
Copy Markdown
MemberAuthor

Tanks for pointing this out. This should be called MetaTrainer as per the summary #2762 (comment)


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

// estimator, as opposed to a regular trainer.
var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName);
return TrainerUtils.MapTrainerEstimatorToTrainer<MulticlassLogisticRegression,
var trainerEstimator = new LogisticRegressionMulticlassClassificationTrainer(env, LabelColumnName, FeatureColumnName);

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 55, length = 49)

this will get ppl confused because it has both Regression and Multiclass on the name, but can't think of a good way to deal with it. would it be ok to just call it Logit @wschin@TomFinley

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 would especially hesitate to call it Logit . Logits has a different interpretation related to the unnormalized log-probabilities


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

@@ -1,4 +1,4 @@
MulticlassLogisticRegression bias and non-zero weights
LogisticRegressionMulticlassClassificationTrainer bias and non-zero weights

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.

LogisticRegressionMulticlassClassificationTrainer [](start = 0, length = 49)

how can this be shorter... anyone in favor of dropping 'Classification'

(env, labelName, featuresName, weightsName) =>
{
var trainer = new SdcaBinaryTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);
var trainer = new SdcaCalibratedBinaryClassificationTrainer(env, labelName, featuresName, weightsName, l2Regularization, l1Threshold, numberOfIterations);

@sfilipisfilipiMar 12, 2019

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.

SdcaCalibratedBinaryClassificationTrainer [](start = 38, length = 41)

Did leave a note below, but i'd be ok dropping Classification from all BinaryClassification and MulticlassClassification.

@abgoswamabgoswamMar 12, 2019

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.

note below .. am not getting you ? The changes here are as per what we summarized in #2762 (comment)


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

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

:shipit:


/// <summary>
/// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>.
/// Predict a target using generalized additive models trained with the <see cref="GamBinaryClassificationTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 wonder if we should connect the acronyms in the doc:

Predict a target using generalized additive models (GAM) trained with the <see cref="GamBinaryClassificationTrainer"/>. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Thanks for the suggestion. Will fix. #Resolved

/// ]]></format>
/// </example>
public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrainers catalog,
public static KMeansPlusPlusTrainer KMeansPlusPlus(this ClusteringCatalog.ClusteringTrainers catalog,

@eerhardteerhardtMar 12, 2019

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 we should be consistent everywhere about this name. If we really intend for this to be KMeansPlusPlus, then we should update all the places that just use KMeans:

The name of the above class:
public static class KMeansClusteringExtensions

The name of the assembly:
Microsoft.ML.KMeansClustering

Is there any confusion about just using the name KMeans? Are there other KMeans algorithms besides KMeans++? It feels like we should be fine just using KMeans, but I'll leave it up to the experts. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Kmeans++ is a slightly modified version of Kmeans that has some smarts for choosing the initial cluster centers. The trainer estimator we have currently implements Kmeans++

For the specific trainer implementation we have currently, we are using KMeansPlusPlus for the MLContext name and KMeansPlusPlusTrainer the Class name

I can envision that in the future one might even want to implement the vanilla Kmeans algorithm itself. As such to me it makes sense to keep the name of the static class and assembly with just KMeans in the prefix.


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

@wschinwschinMar 12, 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.

My feeling is that no one will add Kmeans as long as Kmeans++ exists. As you mentioned, Kmeans++ is a member of Kmeans family. Why can't we call it Kmeans? If someone want to implement the original Kmeans, it can be called NaiveKmeans. #Resolved

@abgoswamabgoswamMar 12, 2019

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.

Sure. That makes sense. Will rename it to KMeans to keep things uniform #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.

Thanks. I also noticed there is a property InitializationAlgorithm to specify the initialization mechanism

So yeah. It should be just KMeans


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

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.

fixed. We should indeed call it KMeans


In reply to: 264757754 [](ancestors = 264757754,264707009)

using TScalarTrainer = ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictorProducing<float>>, IPredictorProducing<float>>;

public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>
public abstract class MetaTrainer<TTransformer, TModel> : ITrainerEstimator<TTransformer, TModel>, ITrainer<IPredictor>

@eerhardteerhardtMar 12, 2019

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 a special case of our rule:

{TypeOfTask} is added only only when the algorithm supports multiple kinds of tasks

I don't believe MetaTrainer is a good name here since it too general. And technically, Meta isn't an algorithm. That name makes it sound like it can train anything. I think we should keep "multiclass" in the name. So probably MetaMulticlassClassificationTrainer. #Closed

@abgoswamabgoswamMar 12, 2019

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.

Yeah. It makes sense to treat this as a special case. #Resolved

{
/// <summary>
/// Predict a target using a linear classification model trained with <see cref="SgdBinaryTrainer"/>.
/// Predict a target using a linear classification model trained with <see cref="SgdCalibratedTrainer"/>.

@eerhardteerhardtMar 12, 2019

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 a place where the acronym Sgd isn't expanded out in the summary comments. #Resolved

@abgoswam
abgoswam requested a review from eerhardtMarch 12, 2019 20:08
.AppendCacheCheckpoint(mlContext)
// Add the SDCA regression trainer.
.Append(mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Target", featureColumnName: "FeatureVector"));
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Target", featureColumnName: "FeatureVector"));

@eerhardteerhardtMar 12, 2019

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.

when we update the cookbook samples files, it usually means the cookbook needs to be updated. #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.

thanks for pointing this out!


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

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

:shipit:

@abgoswam
abgoswam merged commit 7f0c1ad into dotnet:masterMar 12, 2019
@abgoswam

Copy link
Copy Markdown
MemberAuthor

Thanks folks for the review comments!

@abgoswam
abgoswam deleted the abgoswam/trainerestimator_names branch March 20, 2019 20:13
@ghostghost locked as resolved and limited conversation to collaborators Mar 23, 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.

5 participants

@abgoswam@artidoro@wschin@eerhardt@sfilipi