@@ -134,7 +134,7 @@ internal sealed class TaggedOptions
134
134
}
135
135
136
136
[ BestFriend ]
137
- internal sealed class ColumnInfo
137
+ internal sealed class ColumnOptions
138
138
{
139
139
public readonly string Name ;
140
140
private readonly ( string name , string alias ) [ ] _sources ;
@@ -143,7 +143,7 @@ internal sealed class ColumnInfo
143
143
/// <summary>
144
144
/// This denotes a concatenation of all <paramref name="inputColumnNames"/> into column called <paramref name="name"/>.
145
145
/// </summary>
146
- public ColumnInfo ( string name , params string [ ] inputColumnNames )
146
+ public ColumnOptions ( string name , params string [ ] inputColumnNames )
147
147
: this ( name , GetPairs ( inputColumnNames ) )
148
148
{
149
149
}
@@ -159,7 +159,7 @@ public ColumnInfo(string name, params string[] inputColumnNames)
159
159
/// For each input column, an 'alias' can be specified, to be used in constructing the resulting slot names.
160
160
/// If the alias is not specified, it defaults to be column name.
161
161
/// </summary>
162
- public ColumnInfo ( string name , IEnumerable < ( string name , string alias ) > inputColumnNames )
162
+ public ColumnOptions ( string name , IEnumerable < ( string name , string alias ) > inputColumnNames )
163
163
{
164
164
Contracts . CheckNonEmpty ( name , nameof ( name ) ) ;
165
165
Contracts . CheckValue ( inputColumnNames , nameof ( inputColumnNames ) ) ;
@@ -195,7 +195,7 @@ public void Save(ModelSaveContext ctx)
195
195
}
196
196
}
197
197
198
- internal ColumnInfo ( ModelLoadContext ctx )
198
+ internal ColumnOptions ( ModelLoadContext ctx )
199
199
{
200
200
Contracts . AssertValue ( ctx ) ;
201
201
// *** Binary format ***
@@ -218,7 +218,7 @@ internal ColumnInfo(ModelLoadContext ctx)
218
218
}
219
219
}
220
220
221
- private readonly ColumnInfo [ ] _columns ;
221
+ private readonly ColumnOptions [ ] _columns ;
222
222
223
223
/// <summary>
224
224
/// The names of the output and input column pairs for the transformation.
@@ -232,14 +232,14 @@ internal ColumnInfo(ModelLoadContext ctx)
232
232
/// The column types must match, and the output column type is always a vector.
233
233
/// </summary>
234
234
internal ColumnConcatenatingTransformer ( IHostEnvironment env , string outputColumnName , params string [ ] inputColumnNames )
235
- : this ( env , new ColumnInfo ( outputColumnName , inputColumnNames ) )
235
+ : this ( env , new ColumnOptions ( outputColumnName , inputColumnNames ) )
236
236
{
237
237
}
238
238
239
239
/// <summary>
240
240
/// Concatenates multiple groups of columns, each group is denoted by one of <paramref name="columns"/>.
241
241
/// </summary>
242
- internal ColumnConcatenatingTransformer ( IHostEnvironment env , params ColumnInfo [ ] columns ) :
242
+ internal ColumnConcatenatingTransformer ( IHostEnvironment env , params ColumnOptions [ ] columns ) :
243
243
base ( Contracts . CheckRef ( env , nameof ( env ) ) . Register ( nameof ( ColumnConcatenatingTransformer ) ) )
244
244
{
245
245
Contracts . CheckValue ( columns , nameof ( columns ) ) ;
@@ -272,7 +272,7 @@ private protected override void SaveModel(ModelSaveContext ctx)
272
272
// *** Binary format ***
273
273
// int: number of columns
274
274
// for each column:
275
- // columnInfo
275
+ // columnOptions
276
276
277
277
Contracts . Assert ( _columns . Length > 0 ) ;
278
278
ctx . Writer . Write ( _columns . Length ) ;
@@ -293,18 +293,18 @@ private ColumnConcatenatingTransformer(IHostEnvironment env, ModelLoadContext ct
293
293
// *** Binary format ***
294
294
// int: number of columns
295
295
// for each column:
296
- // columnInfo
296
+ // columnOptions
297
297
int n = ctx . Reader . ReadInt32 ( ) ;
298
298
Contracts . CheckDecode ( n > 0 ) ;
299
- _columns = new ColumnInfo [ n ] ;
299
+ _columns = new ColumnOptions [ n ] ;
300
300
for ( int i = 0 ; i < n ; i ++ )
301
- _columns [ i ] = new ColumnInfo ( ctx ) ;
301
+ _columns [ i ] = new ColumnOptions ( ctx ) ;
302
302
}
303
303
else
304
304
_columns = LoadLegacy ( ctx ) ;
305
305
}
306
306
307
- private ColumnInfo [ ] LoadLegacy ( ModelLoadContext ctx )
307
+ private ColumnOptions [ ] LoadLegacy ( ModelLoadContext ctx )
308
308
{
309
309
// *** Legacy binary format ***
310
310
// int: sizeof(Float).
@@ -359,9 +359,9 @@ private ColumnInfo[] LoadLegacy(ModelLoadContext ctx)
359
359
}
360
360
}
361
361
362
- var result = new ColumnInfo [ n ] ;
362
+ var result = new ColumnOptions [ n ] ;
363
363
for ( int i = 0 ; i < n ; i ++ )
364
- result [ i ] = new ColumnInfo ( names [ i ] ,
364
+ result [ i ] = new ColumnOptions ( names [ i ] ,
365
365
inputs [ i ] . Zip ( aliases [ i ] , ( name , alias ) => ( name , alias ) ) ) ;
366
366
return result ;
367
367
}
@@ -380,7 +380,7 @@ internal static IDataTransform Create(IHostEnvironment env, Options options, IDa
380
380
env . CheckUserArg ( Utils . Size ( options . Columns [ i ] . Source ) > 0 , nameof ( options . Columns ) ) ;
381
381
382
382
var cols = options . Columns
383
- . Select ( c => new ColumnInfo ( c . Name , c . Source ) )
383
+ . Select ( c => new ColumnOptions ( c . Name , c . Source ) )
384
384
. ToArray ( ) ;
385
385
var transformer = new ColumnConcatenatingTransformer ( env , cols ) ;
386
386
return transformer . MakeDataTransform ( input ) ;
@@ -400,7 +400,7 @@ internal static IDataTransform Create(IHostEnvironment env, TaggedOptions option
400
400
env . CheckUserArg ( Utils . Size ( options . Columns [ i ] . Source ) > 0 , nameof ( options . Columns ) ) ;
401
401
402
402
var cols = options . Columns
403
- . Select ( c => new ColumnInfo ( c . Name , c . Source . Select ( kvp => ( kvp . Value , kvp . Key != "" ? kvp . Key : null ) ) ) )
403
+ . Select ( c => new ColumnOptions ( c . Name , c . Source . Select ( kvp => ( kvp . Value , kvp . Key != "" ? kvp . Key : null ) ) ) )
404
404
. ToArray ( ) ;
405
405
var transformer = new ColumnConcatenatingTransformer ( env , cols ) ;
406
406
return transformer . MakeDataTransform ( input ) ;
@@ -526,7 +526,7 @@ private sealed class BoundColumn
526
526
{
527
527
public readonly int [ ] SrcIndices ;
528
528
529
- private readonly ColumnInfo _columnInfo ;
529
+ private readonly ColumnOptions _columnOptions ;
530
530
private readonly DataViewType [ ] _srcTypes ;
531
531
532
532
public readonly VectorType OutputType ;
@@ -542,10 +542,10 @@ private sealed class BoundColumn
542
542
543
543
private readonly DataViewSchema _inputSchema ;
544
544
545
- public BoundColumn ( DataViewSchema inputSchema , ColumnInfo columnInfo , int [ ] sources , VectorType outputType ,
545
+ public BoundColumn ( DataViewSchema inputSchema , ColumnOptions columnOptions , int [ ] sources , VectorType outputType ,
546
546
bool isNormalized , bool hasSlotNames , bool hasCategoricals , int slotCount , int catCount )
547
547
{
548
- _columnInfo = columnInfo ;
548
+ _columnOptions = columnOptions ;
549
549
SrcIndices = sources ;
550
550
_srcTypes = sources . Select ( c => inputSchema [ c ] . Type ) . ToArray ( ) ;
551
551
@@ -570,7 +570,7 @@ public DataViewSchema.DetachedColumn MakeSchemaColumn()
570
570
if ( _isIdentity )
571
571
{
572
572
var inputCol = _inputSchema [ SrcIndices [ 0 ] ] ;
573
- return new DataViewSchema . DetachedColumn ( _columnInfo . Name , inputCol . Type , inputCol . Annotations ) ;
573
+ return new DataViewSchema . DetachedColumn ( _columnOptions . Name , inputCol . Type , inputCol . Annotations ) ;
574
574
}
575
575
576
576
var metadata = new DataViewSchema . Annotations . Builder ( ) ;
@@ -581,7 +581,7 @@ public DataViewSchema.DetachedColumn MakeSchemaColumn()
581
581
if ( _hasCategoricals )
582
582
metadata . Add ( AnnotationUtils . Kinds . CategoricalSlotRanges , _categoricalRangeType , ( ValueGetter < VBuffer < int > > ) GetCategoricalSlotRanges ) ;
583
583
584
- return new DataViewSchema . DetachedColumn ( _columnInfo . Name , OutputType , metadata . ToAnnotations ( ) ) ;
584
+ return new DataViewSchema . DetachedColumn ( _columnOptions . Name , OutputType , metadata . ToAnnotations ( ) ) ;
585
585
}
586
586
587
587
private void GetIsNormalized ( ref bool value ) => value = _isNormalized ;
@@ -630,9 +630,9 @@ private void GetSlotNames(ref VBuffer<ReadOnlyMemory<char>> dst)
630
630
{
631
631
int colSrc = SrcIndices [ i ] ;
632
632
var typeSrc = _srcTypes [ i ] ;
633
- Contracts . Assert ( _columnInfo . Sources [ i ] . alias != "" ) ;
633
+ Contracts . Assert ( _columnOptions . Sources [ i ] . alias != "" ) ;
634
634
var colName = _inputSchema [ colSrc ] . Name ;
635
- var nameSrc = _columnInfo . Sources [ i ] . alias ?? colName ;
635
+ var nameSrc = _columnOptions . Sources [ i ] . alias ?? colName ;
636
636
if ( ! ( typeSrc is VectorType vectorTypeSrc ) )
637
637
{
638
638
bldr . AddFeature ( slot ++ , nameSrc . AsMemory ( ) ) ;
@@ -650,7 +650,7 @@ private void GetSlotNames(ref VBuffer<ReadOnlyMemory<char>> dst)
650
650
{
651
651
inputMetadata . GetValue ( AnnotationUtils . Kinds . SlotNames , ref names ) ;
652
652
sb . Clear ( ) ;
653
- if ( _columnInfo . Sources [ i ] . alias != colName )
653
+ if ( _columnOptions . Sources [ i ] . alias != colName )
654
654
sb . Append ( nameSrc ) . Append ( "." ) ;
655
655
int len = sb . Length ;
656
656
foreach ( var kvp in names . Items ( ) )
@@ -801,15 +801,15 @@ private Delegate MakeGetter<T>(DataViewRow input)
801
801
public KeyValuePair < string , JToken > SavePfaInfo ( BoundPfaContext ctx )
802
802
{
803
803
Contracts . AssertValue ( ctx ) ;
804
- string outName = _columnInfo . Name ;
804
+ string outName = _columnOptions . Name ;
805
805
if ( ! OutputType . IsKnownSize ) // Do not attempt variable length.
806
806
return new KeyValuePair < string , JToken > ( outName , null ) ;
807
807
808
808
string [ ] srcTokens = new string [ SrcIndices . Length ] ;
809
809
bool [ ] srcPrimitive = new bool [ SrcIndices . Length ] ;
810
810
for ( int i = 0 ; i < SrcIndices . Length ; ++ i )
811
811
{
812
- var srcName = _columnInfo . Sources [ i ] . name ;
812
+ var srcName = _columnOptions . Sources [ i ] . name ;
813
813
if ( ( srcTokens [ i ] = ctx . TokenOrNullForName ( srcName ) ) == null )
814
814
return new KeyValuePair < string , JToken > ( outName , null ) ;
815
815
srcPrimitive [ i ] = _srcTypes [ i ] is PrimitiveDataViewType ;
0 commit comments