-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added convenience constructor for set of transforms (#380). #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
bfac765
20d9194
44e8e8d
d3c627e
5a34a16
1566ed0
e9b1023
05637d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,17 @@ private static VersionInfo GetVersionInfo() | |
| private const string DropRegistrationName = "DropColumns"; | ||
| private const string KeepRegistrationName = "KeepColumns"; | ||
|
|
||
| /// <summary> | ||
| /// 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> | ||
| /// <param name="columnsToDrop">Name of the columns to be dropped.</param> | ||
| public DropColumnsTransform(IHostEnvironment env, IDataView input, params string[] columnsToDrop) | ||
| :this(env, new Arguments() { Column = columnsToDrop }, input) | ||
| { | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In order to keep columns, we do The fact that we do so in the underlying C# code is just because previously this little bit of confusion didn't matter, since we weren't advocating that people use this directly. However since we now are, we ought to adjust accordingly. For that reason, I wonder if we can make the relationship explicit... public static class KeepColumnsTransform
{
public IDataTransform Create(IHostEnvironment env, IDataView input, params string[] columnsToKeep)
=> new DropColumnsTransform(env, new KeepArguments() { Column = columnsToKeep }, input);
}or something along these lines. Once that ambiguity is resolved, we can change "drop" creator back to a plain old constructor. #Closed |
||
|
|
||
| /// <summary> | ||
| /// Public constructor corresponding to SignatureDataTransform. | ||
| /// </summary> | ||
|
|
@@ -383,4 +394,17 @@ public ValueGetter<TValue> GetGetter<TValue>(int col) | |
| } | ||
| } | ||
| } | ||
|
|
||
| public class KeepColumnsTransform | ||
| { | ||
| /// <summary> | ||
| /// A helper method to create <see cref="KeepColumnsTransform"/> 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> | ||
| /// <param name="columnsToKeep">Name of the columns to be kept. All other columns will be removed.</param> | ||
| /// <returns></returns> | ||
| public static IDataTransform Create(IHostEnvironment env, IDataView input, params string[] columnsToKeep) | ||
| => new DropColumnsTransform(env, new DropColumnsTransform.KeepArguments() { Column = columnsToKeep }, input); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank lines with trailing whitespace on them is evil. #Resolved