[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs
, '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

[Part 3] Added convenience constructors for set of transforms. - #520

Merged
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3
Jul 16, 2018
Merged

[Part 3] Added convenience constructors for set of transforms.#520
zeahmed merged 6 commits into
dotnet:masterfrom
zeahmed:convenience_constructor3

Conversation

@zeahmed

Copy link
Copy Markdown
Contributor

This PR fixes#518. The convenience constructors were added for following transforms.

  • GroupTransform.cs
  • HashJoinTransform.cs
  • KeyToBinaryVectorTransform.cs
  • LoadTransform.cs
  • MissingValueIndicatorTransform.cs
  • MutualInformationFeatureSelectionTransform.cs
  • NADropTransform.cs
  • NAHandleTransform.cs
  • NAIndicatorTransform.cs
  • NAReplaceTransform.cs
  • OptionalColumnTransform.cs
  • RffTransform.cs
  • UngroupTransform.cs
  • WhiteningTransform.cs

private readonly SchemaImpl _schemaImpl;

/// <summary>
/// Convenience constructor for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

Convenience constructor for public facing API. [](start = 12, length = 46)

We might want to improve this description, since from the point of view of the user it doesn't really help them much to know that they're using the public facing API really. #Closed

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.

Ah... I see this was mostly done via copy-paste, I'm afraid that an actual description will be necessary. Look on the bright side, I think that an understanding of how it could be used can only help you imagine the best way in which the convenience should be structured.


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

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.

Probably obvious, but just in case not clear this is intended as a general comment.


In reply to: 201912669 [](ancestors = 201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I was also thinking about adding more description to the constructors and wanted to open a separate issue to include clear description to each of the convenience constructors. What do you say?


In reply to: 201912748 [](ancestors = 201912748,201912669,201910848)

@zeahmedzeahmedJul 12, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Opened issue #524 for addressing this comment. Because it needs to be done for all the transforms we have worked so far.


In reply to: 202117587 [](ancestors = 202117587,201912748,201912669,201910848)

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.

Fair enough, sounds good @zeahmed


In reply to: 202121318 [](ancestors = 202121318,202117587,201912748,201912669,201910848)

/// Convenience constructor for public facing API.
/// </summary>
/// <param name="env">Host Environment.</param>
/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

Input . This is the output from previous transform or loader [](start = 32, length = 83)

This on the other hand might be over-description. Certainly this is not the best place for people to learn how to instantiate IDataViews if they don't already know how to do so. in It's also not quite correct, since there are certainly other data views other than loaders and transforms. #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ok, I will update it as a part of this issue #524.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 }

Descriptions of these might be good.

I see that the summary comment on the class itself already has some documentation. The relevant section where it explains the enum should be moved, and formatted appropriately, etc. #Closed


Refers to: src/Microsoft.ML.Transforms/UngroupTransform.cs:69 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>

@TomFinleyTomFinleyJul 12, 2018

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.

/// The number of random Fourier features to create. [](start = 8, length = 81)

This ought to be required. #Closed

/// <param name="name">Name of the output column.</param>
/// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
/// <param name="newDim">The number of random Fourier features to create.</param>
/// <param name="useSin">create two features for every random Fourier frequency? (one for cos and one for sin).</param>

@TomFinleyTomFinleyJul 12, 2018

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.

create two features for every random Fourier frequency? [](start = 33, length = 55)

So, if newDim was 10, and I set this to true, does the output become 20 or something?

This guy is a little complex. I wonder if we can get away with not including it in the convenience? #Closed

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, it creates 2 * newDim features when useSin=true. Yes, we can remove useSin parameter as it's default value is also false.


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

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "ProduceIdTransform", "ProduceId")]

My thinking is that transforms that are hidden probably don't need convenience constructors. This thing in particular is mostly something I have for debugging. #Closed


Refers to: src/Microsoft.ML.Transforms/ProduceIdTransform.cs:12 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

I'm not sure what this class is, ad why it isn't sealed. Do you understand it? #Closed


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
 Maximum,

Now that these are being used as programmatic constructs maybe migrate the documentation above. #Closed


Refers to: src/Microsoft.ML.Transforms/NAHandleTransform.cs:43 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

internal static string RegistrationName = "MutualInformationFeatureSelectionTransform";

/// <summary>
/// A helper method to create <see cref="MutualInformationFeatureSelectionTransform"/> for public facing API.

@TomFinleyTomFinleyJul 12, 2018

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.

MutualInformationFeatureSelectionTransform [](start = 49, length = 42)

You can't be creating it, it's a static class. #Closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar comments as before, when documenting we ought to describe what it is actually useful for, not just describing its return values (which are part of the method signature, and we aren't even doing that quite right).


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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I will add detailed comments as part of #524.


In reply to: 201912123 [](ancestors = 201912123,201912038)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
"", "MissingValueIndicatorTransform", "MissingValueTransform", "MissingTransform", "Missing")]

Same, this is hidden, and mostly deprecated in favor of the NAIndicatorTransform. We only really have it around for backwards compatibility reasons... #Closed


Refers to: src/Microsoft.ML.Transforms/MissingValueIndicatorTransform.cs:16 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@TomFinley

TomFinley commented Jul 12, 2018

Copy link
Copy Markdown
Contributor
/// Tom [Table, Kitten]

Oh, memories. :D #Closed


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

/// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
/// <param name="groupKey">Columns to group by</param>
/// <param name="columns">Columns to group together</param>
public GroupTransform(IHostEnvironment env, IDataView input, string[] groupKey, params string[] columns)

@TomFinleyTomFinleyJul 12, 2018

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.

string[] groupKey [](start = 69, length = 17)

Considering the cases I'm aware of where it is used, I have to think that a single string would be preferable for the convenience constructor. #Closed

@zeahmed

zeahmed commented Jul 12, 2018

Copy link
Copy Markdown
ContributorAuthor
public class OptionalColumnTransform : RowToRowMapperTransformBase

After a long discussion yesterday on a separate thread I got to know the purpose of this transform.

This is the transform used to mark some of the columns (e.g. Label) optional during training. So that the columns is not required during scoring. At scoring time, TLC checks to see if the data schema for scoring matches the data used for training except for the optional columns.

I am not sure why its not sealed. Looking at all other transforms, I assume it should be sealed as well. I am not changing it right now unless you see it feasible to do so.


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


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

@zeahmed

Copy link
Copy Markdown
ContributorAuthor
/// Tom [Table, Kitten]

hahaha...easy to catch culprits this way...:D


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


Refers to: src/Microsoft.ML.Transforms/GroupTransform.cs:50 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

private static class Defaults
{
public const string Column = "Id";
}

@TomFinleyTomFinleyJul 13, 2018

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.

I think we probably don't need this Defaults class any longer. #Closed

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.

Indeed we might as well revert the whole file probably.


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

/// <summary>
///
/// </summary>
public enum ReplacementKind

@TomFinleyTomFinleyJul 13, 2018

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.

Empty? #Closed

@TomFinley

Copy link
Copy Markdown
Contributor
public class OptionalColumnTransform : RowToRowMapperTransformBase

May as well. And since you've gone to the effort of digging up what it's actually useful for maybe just paste that into an XML comment.


In reply to: 404611599 [](ancestors = 404611599,404392058)


Refers to: src/Microsoft.ML.Transforms/OptionalColumnTransform.cs:29 in d9c4a29. [](commit_id = d9c4a29, deletion_comment = False)

public enum UngroupMode
{
/// <summary>
/// A number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

All these "A number" would read better as "The number". #Closed

@TomFinley

TomFinley commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Getting really close thanks @zeahmed! #Closed

/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.
/// </summary>
public class OptionalColumnTransform : RowToRowMapperTransformBase

@TomFinleyTomFinleyJul 13, 2018

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.

public class [](start = 4, length = 12)

Sealed? :) #Closed

Outer,

/// <summary>
/// The number of output rows are equal to the length of the first pivot column.

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

Inner,

/// <summary>
/// The number of output rows are equal to the maximum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

public enum UngroupMode
{
/// <summary>
/// The number of output rows are equal to the minimum length of pivot columns

@TomFinleyTomFinleyJul 13, 2018

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.

are [](start = 42, length = 3)

is equal #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

So [](start = 97, length = 2)

lower case "so" since this is in the middle of a sentence? #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

columns is [](start = 109, length = 10)

"columns is" => "columns are" #Closed

namespace Microsoft.ML.Runtime.DataPipe
{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..

@TomFinleyTomFinleyJul 13, 2018

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.

.. [](start = 147, length = 2)

One period instead of two. #Closed

{
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training So that the columns is not required during scoring..
/// At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns.

@TomFinleyTomFinleyJul 13, 2018

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.

At scoring time, it is checked if the data schema for scoring matches the data used for training except for the optional columns. [](start = 8, length = 129)

I'm not sure I actually understand this. What it really does is, if the column is not there, it will make it appear as if it is there with metadata filled in, and if the column is requested will return entirely default values. Or so I understand the code in the cursor. Is there some way to describe it in a way that communicates that? I'm not sure this sentence here actually communicates that. #Closed

public class OptionalColumnTransform : RowToRowMapperTransformBase
/// <summary>
/// This transform is used to mark some of the columns (e.g. Label) optional during training so that the columns are not required during scoring.
/// When applied to new data, if optional columns are not present a meta column is created having the same properties (e.g. 'name', 'type' etc.) as used during training.

@TomFinleyTomFinleyJul 13, 2018

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.

meta column [](start = 72, length = 11)

The phrase meta-column is a bit odd, I'm not sure that's a good description. Maybe dummy column? Mock column? #Closed

/// - scalar for scalar column
/// - totally sparse vector for vector column.
/// If value of the column is requested the default value will be returned.
/// </summary>

@TomFinleyTomFinleyJul 13, 2018

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.

This last line seems redundant. #Closed

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@codemzscodemzs 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:

@zeahmed

Copy link
Copy Markdown
ContributorAuthor

Thanks @TomFinley and @codemzs!

@zeahmed
zeahmed merged commit c491651 into dotnet:masterJul 16, 2018
@zeahmed
zeahmed deleted the convenience_constructor3 branch July 17, 2018 17:42
eerhardt pushed a commit to eerhardt/machinelearning that referenced this pull request Jul 27, 2018
@ghostghost locked as resolved and limited conversation to collaborators Mar 30, 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.

[Part 3] Create convenience constructor for the listed Transforms.

3 participants

@zeahmed@TomFinley@codemzs