18
18
using Microsoft . ML . Transforms ;
19
19
20
20
[ assembly: LoadableClass ( ColumnCopyingTransformer . Summary , typeof ( IDataTransform ) , typeof ( ColumnCopyingTransformer ) ,
21
- typeof ( ColumnCopyingTransformer . Arguments ) , typeof ( SignatureDataTransform ) ,
21
+ typeof ( ColumnCopyingTransformer . Options ) , typeof ( SignatureDataTransform ) ,
22
22
ColumnCopyingTransformer . UserName , "CopyColumns" , "CopyColumnsTransform" , ColumnCopyingTransformer . ShortName ,
23
23
DocName = "transform/CopyColumnsTransformer.md" ) ]
24
24
@@ -35,16 +35,21 @@ namespace Microsoft.ML.Transforms
35
35
{
36
36
public sealed class ColumnCopyingEstimator : TrivialEstimator < ColumnCopyingTransformer >
37
37
{
38
- public ColumnCopyingEstimator ( IHostEnvironment env , string outputColumnName , string inputColumnName ) :
38
+ [ BestFriend ]
39
+ internal ColumnCopyingEstimator ( IHostEnvironment env , string outputColumnName , string inputColumnName ) :
39
40
this ( env , ( outputColumnName , inputColumnName ) )
40
41
{
41
42
}
42
43
43
- public ColumnCopyingEstimator ( IHostEnvironment env , params ( string outputColumnName , string inputColumnName ) [ ] columns )
44
+ internal ColumnCopyingEstimator ( IHostEnvironment env , params ( string outputColumnName , string inputColumnName ) [ ] columns )
44
45
: base ( Contracts . CheckRef ( env , nameof ( env ) ) . Register ( nameof ( ColumnCopyingEstimator ) ) , new ColumnCopyingTransformer ( env , columns ) )
45
46
{
46
47
}
47
48
49
+ /// <summary>
50
+ /// Returns the <see cref="SchemaShape"/> of the schema which will be produced by the transformer.
51
+ /// Used for schema propagation and verification in a pipeline.
52
+ /// </summary>
48
53
public override SchemaShape GetOutputSchema ( SchemaShape inputSchema )
49
54
{
50
55
Host . CheckValue ( inputSchema , nameof ( inputSchema ) ) ;
@@ -82,12 +87,12 @@ private static VersionInfo GetVersionInfo()
82
87
loaderAssemblyName : typeof ( ColumnCopyingTransformer ) . Assembly . FullName ) ;
83
88
}
84
89
85
- public ColumnCopyingTransformer ( IHostEnvironment env , params ( string outputColumnName , string inputColumnName ) [ ] columns )
90
+ internal ColumnCopyingTransformer ( IHostEnvironment env , params ( string outputColumnName , string inputColumnName ) [ ] columns )
86
91
: base ( Contracts . CheckRef ( env , nameof ( env ) ) . Register ( nameof ( ColumnCopyingTransformer ) ) , columns )
87
92
{
88
93
}
89
94
90
- public sealed class Column : OneToOneColumn
95
+ internal sealed class Column : OneToOneColumn
91
96
{
92
97
internal static Column Parse ( string str )
93
98
{
@@ -106,20 +111,20 @@ internal bool TryUnparse(StringBuilder sb)
106
111
}
107
112
}
108
113
109
- public sealed class Arguments : TransformInputBase
114
+ internal sealed class Options : TransformInputBase
110
115
{
111
116
[ Argument ( ArgumentType . Multiple | ArgumentType . Required , HelpText = "New column definition(s) (optional form: name:src)" ,
112
117
Name = "Column" , ShortName = "col" , SortOrder = 1 ) ]
113
118
public Column [ ] Columns ;
114
119
}
115
120
116
121
// Factory method corresponding to SignatureDataTransform.
117
- internal static IDataTransform Create ( IHostEnvironment env , Arguments args , IDataView input )
122
+ internal static IDataTransform Create ( IHostEnvironment env , Options options , IDataView input )
118
123
{
119
124
Contracts . CheckValue ( env , nameof ( env ) ) ;
120
- env . CheckValue ( args , nameof ( args ) ) ;
125
+ env . CheckValue ( options , nameof ( options ) ) ;
121
126
122
- var transformer = new ColumnCopyingTransformer ( env , args . Columns . Select ( x => ( x . Name , x . Source ) ) . ToArray ( ) ) ;
127
+ var transformer = new ColumnCopyingTransformer ( env , options . Columns . Select ( x => ( x . Name , x . Source ) ) . ToArray ( ) ) ;
123
128
return transformer . MakeDataTransform ( input ) ;
124
129
}
125
130
0 commit comments