Skip to content

adding some trainer extensions on the StandardLearners catalog. Correcting namespace, and names #1682

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Nov 27, 2018

Conversation

sfilipi
Copy link
Member

@sfilipi sfilipi commented Nov 20, 2018

The last PR addressing #1318.
Closes #1318

@sfilipi sfilipi self-assigned this Nov 20, 2018
@sfilipi sfilipi added the API Issues pertaining the friendly API label Nov 20, 2018
@sfilipi sfilipi added this to the 1118 milestone Nov 20, 2018
@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Nov 20, 2018

I see lot of tests failing with different issues, can you take a look on them? #Closed

/// <param name="labelColumn">The name of the label column.</param>
/// <param name="advancedSettings">A delegate to apply all the advanced arguments to the algorithm.</param>
/// <param name="context">The <see cref="TrainerEstimatorContext"/> for additional input data to training.</param>
public static MatrixFactorizationTrainer MatrixFactorization(this RegressionContext.RegressionTrainers ctx,
Copy link
Contributor

@Zruty0 Zruty0 Nov 20, 2018

Choose a reason for hiding this comment

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

RegressionContext [](start = 74, length = 17)

I don't like this to be part of regression context. #Resolved

WhiteningKind kind = VectorWhiteningTransformer.Defaults.Kind,
float eps = VectorWhiteningTransformer.Defaults.Eps,
int maxRows = VectorWhiteningTransformer.Defaults.MaxRows,
int pcaNum = VectorWhiteningTransformer.Defaults.PcaNum)
Copy link
Contributor

@Zruty0 Zruty0 Nov 20, 2018

Choose a reason for hiding this comment

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

fix indentation #Resolved

Copy link
Contributor

@Zruty0 Zruty0 left a comment

Choose a reason for hiding this comment

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

:shipit:

@sfilipi sfilipi changed the title adding some trainer extensions on the StandartLearners catalog. Correcting namespace, and names [WIP] adding some trainer extensions on the StandartLearners catalog. Correcting namespace, and names Nov 20, 2018
@sfilipi sfilipi changed the title [WIP] adding some trainer extensions on the StandartLearners catalog. Correcting namespace, and names adding some trainer extensions on the StandardLearners catalog. Correcting namespace, and names Nov 21, 2018
@@ -249,7 +250,7 @@ private string GetBuildPrefix()
#endif
}

[Fact(Skip = "Execute this test if you want to regenerate the core_manifest and core_ep_list files")]
[Fact]
Copy link
Member Author

@sfilipi sfilipi Nov 21, 2018

Choose a reason for hiding this comment

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

[Fact] [](start = 5, length = 9)

revert #Resolved

…o swap names.

Adding the Recommendation context.

/// <summary>
/// Initializes a new instance of <see cref="ValueToKeyMappingEstimator"/>.
/// </summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

I think we want to have proper comment with explanation what this extension for other than this. #Closed


/// <summary>
/// Initializes a new instance of <see cref="ValueToKeyMappingEstimator"/> loading the terms to use from <paramref name="file"/>.
/// </summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

same as above. #Closed


namespace Microsoft.ML
{
public static class ProjectionCatalog
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

out of curiosity, why? #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

Thy said "one per assembly" so moved it to the HalLearners catalog.


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

@@ -691,6 +692,10 @@ internal static class Defaults
{
}

/// <summary>Initializes a new instance of <see cref="PrincipalComponentAnalysisEstimator"/>.</summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

///

Initializes a new instance of . [](start = 8, length = 103)

ugh, formating. #Closed


/// <summary>
/// Initializing a new instance of <see cref="MatrixFactorizationTrainer"/>.
/// </summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

can we have better comment for user facing api? #Closed


/// <summary>
/// Initializes a new instance of <see cref="MultiClassNaiveBayesTrainer"/>
/// </summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

Can we have slightly better comments for user facing api? #Closed

/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="args">The <see cref="TensorFlowTransform.Arguments"/> specifying the inputs and the settings of the <see cref="TensorFlowEstimator"/>.</param>
/// <param name="tensorFlowModel"></param>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

/// [](start = 8, length = 42)

/// The pre-trained TensorFlow model. #Closed

/// <returns></returns>
public static KeyToBinaryVectorMappingEstimator MapKeyToBinaryVector(this TransformsCatalog.ConversionTransforms catalog,
params KeyToBinaryVectorMappingTransformer.ColumnInfo[] columns)
=> new KeyToBinaryVectorMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

=> new [](start = 8, length = 6)

That difference in => position here and in other method drives my OCD nuts. #Closed

/// </summary>
/// <param name="catalog">The categorical transform's catalog.</param>
/// <param name="columns">The input column.</param>
/// <returns></returns>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

/// [](start = 8, length = 23)

omit #Closed

/// <param name="catalog">The categorical transform's catalog.</param>
/// <param name="inputColumn">The name of the input column of the transformation.</param>
/// <param name="outputColumn">The name of the column produced by the transformation.</param>
/// <returns></returns>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

/// [](start = 8, length = 23)

omit #Closed


public static class MissingValueReplacerCatalog
{
/// <summary>
/// Initializes a new instance of <see cref="MissingValueReplacingEstimator"/>
/// </summary>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

we need better summary for user facing api. #Closed

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Nov 21, 2018

    /// <param name="catalog">The categorical transform's catalog.</param>

this description look odd across all methods in this file. Why it's categorical transform's catalog. #Closed


Refers to: src/Microsoft.ML.Transforms/ExtensionsCatalog.cs:17 in 1c44ea2. [](commit_id = 1c44ea2, deletion_comment = False)

/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columns"> Describes the parameters of LDA for each column pair.</param>
public static LatentDirichletAllocationEstimator LatentDirichletAllocation(this TransformsCatalog.TextTransforms catalog, params LatentDirichletAllocationTransformer.ColumnInfo[] columns)
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

LatentDirichletAllocationEstimator [](start = 22, length = 34)

I think Abhishek moved LDA to separate file yesterday, can you merge and wipe it as well? #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

this is post Abishek's merge. By the way, do we want LDA in text or projections?


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

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, got confused between catalog and static extensions. LDA doesn't make much sense outside of text, we use terminology as words, topics, etc. so Text.


In reply to: 235501427 [](ancestors = 235501427,235500231)

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Nov 21, 2018

.Append(mlContext.Transforms.Categorical.MapValueToKey("Label"), TransformerScope.TrainTest)

Conversion

Just reflect changes in CookbookSamplesDynamicApi.cs #Closed


Refers to: docs/code/MlNetCookBook.md:1300 in 1c44ea2. [](commit_id = 1c44ea2, deletion_comment = False)

@artidoro
Copy link
Contributor

artidoro commented Nov 21, 2018

Can you rename the file? #Resolved


Refers to: src/Microsoft.ML.Data/Transforms/ColumnsCopying.cs:4 in 1c44ea2. [](commit_id = 1c44ea2, deletion_comment = False)

@@ -62,7 +63,7 @@ public void MatrixFactorizationSimpleTrainAndPredict()
var data = reader.Read(new MultiFileSource(GetDataPath(TestDatasets.trivialMatrixFactorization.trainFilename)));

// Create a pipeline with a single operator.
var pipeline = new MatrixFactorizationTrainer(mlContext, userColumnName, itemColumnName, labelColumnName,
var pipeline = mlContext.Recommendation().Trainers.MatrixFactorization(userColumnName, itemColumnName, labelColumnName,
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 21, 2018

Choose a reason for hiding this comment

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

mlContext.Recommendation().Trainers.MatrixFactorization( [](start = 27, length = 56)

why I can do
mlContext.BinaryClassification.Trainers.FastTree
but for recommendaion i need to do
mlContext.Recommendation().Trainers
I'm talking about braces. #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

Because RecommendationContext lives in a different assembly and nuget. So it is an extension method to MLContext, rather than a property.

there are no recommendation trainers in ml.net core nuget, no point on having it there and empty. Time series will be the same.


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

@@ -16,7 +15,7 @@ public static class ImageEstimatorsCatalog
/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="columns">The name of the columns containing the image paths(first item of the tuple), and the name of the resulting output column (second item of the tuple).</param>
public static ImageGrayscalingEstimator Grayscale(this TransformsCatalog catalog, params (string input, string output)[] columns)
public static ImageGrayscalingEstimator ConvertToGrayscale(this TransformsCatalog catalog, params (string input, string output)[] columns)
Copy link
Contributor

@artidoro artidoro Nov 21, 2018

Choose a reason for hiding this comment

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

ConvertToGrayscale [](start = 48, length = 18)

Why are we changing the name here? Are we not using the same name as the estimator?

Copy link
Member Author

Choose a reason for hiding this comment

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

The names of the methods are usually PerformAction. ConvertToGrayscale" felt more informative than "Grayscale"


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

Copy link
Contributor

@artidoro artidoro Nov 21, 2018

Choose a reason for hiding this comment

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

I mean why are we not using ImageGrayScalingEstimator? These are calling the dynamic API, so I don't see why we should change names.


In reply to: 235504239 [](ancestors = 235504239,235503615)

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a broader discussion for it here: #1690

I do see your point. As @CESARDELATORRE pointed out, the most correct thing to do would be to call those CreateActionPerformingEstimator.

We chose to go with just the ActionPerforming verb.

https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-type-members#names-of-methods


In reply to: 235504834 [](ancestors = 235504834,235504239,235503615)

/// </summary>
/// <param name="catalog">The categorical transform's catalog.</param>
/// <param name="catalog">The transform extensions' catalog.</param>
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Nov 26, 2018

Choose a reason for hiding this comment

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

' [](start = 58, length = 1)

sneaky apostrophe is sneaky.
across whole file. #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fine, no? The extensions are transform extensions; there are many of them. Possession on plural is followed by apos.


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

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL


In reply to: 236465988 [](ancestors = 236465988,236449673)

@Ivanidzo4ka
Copy link
Contributor

var estimator = mlContext.Transforms.Categorical.MapValueToKey("Label")

This one as well


Refers to: docs/code/MlNetCookBook.md:264 in 437e367. [](commit_id = 437e367, deletion_comment = False)

@Ivanidzo4ka
Copy link
Contributor

.Append(mlContext.Transforms.Categorical.MapValueToKey("Label"), TransformerScope.TrainTest)

And this one?


Refers to: docs/code/MlNetCookBook.md:642 in 437e367. [](commit_id = 437e367, deletion_comment = False)

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

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

:shipit:

@Ivanidzo4ka
Copy link
Contributor

var estimator = mlContext.Transforms.Categorical.MapValueToKey("Label")

-Doctor, everyone ignores me, please tell me what to do?
-Next one, please!


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


Refers to: docs/code/MlNetCookBook.md:264 in 437e367. [](commit_id = 437e367, deletion_comment = False)

@sfilipi sfilipi merged commit 481c377 into dotnet:master Nov 27, 2018
@sfilipi sfilipi deleted the 1318epilogue branch November 27, 2018 20:30
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Issues pertaining the friendly API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants