55
66namespace Samples . Dynamic
77{
8- class MapKeyToVectorMultiColumn
8+ public class MapKeyToVectorMultiColumn
99 {
1010 /// This example demonstrates the use of MapKeyToVector by mapping keys to floats[] for multiple columns at once.
1111 /// Because the ML.NET KeyType maps the missing value to zero, counting starts at 1, so the uint values
@@ -30,10 +30,10 @@ public static void Example()
3030 var data = mlContext . Data . LoadFromEnumerable ( rawData ) ;
3131
3232 // Constructs the ML.net pipeline
33- var pipeline = mlContext . Transforms . Conversion . MapKeyToVector (
34- new [ ] {
35- new InputOutputColumnPair ( "TimeframeVector " , "Timeframe" ) ,
36- new InputOutputColumnPair ( "CategoryVector" , "Category" ) } ) ;
33+ var pipeline = mlContext . Transforms . Conversion . MapKeyToVector ( new [ ] {
34+ new InputOutputColumnPair ( "TimeframeVector" , "Timeframe" ) ,
35+ new InputOutputColumnPair ( "CategoryVector " , "Category" )
36+ } ) ;
3737
3838 // Fits the pipeline to the data.
3939 IDataView transformedData = pipeline . Fit ( data ) . Transform ( data ) ;
@@ -44,7 +44,7 @@ public static void Example()
4444
4545 Console . WriteLine ( $ " Timeframe TimeframeVector Category CategoryVector") ;
4646 foreach ( var featureRow in features )
47- Console . WriteLine ( $ "{ featureRow . Timeframe } \t \t \t { string . Join ( ',' , featureRow . TimeframeVector ) } \t \t \t { featureRow . Category } \t \t { string . Join ( ',' , featureRow . CategoryVector ) } ") ;
47+ Console . WriteLine ( $ "{ featureRow . Timeframe } { string . Join ( ',' , featureRow . TimeframeVector ) } { featureRow . Category } { string . Join ( ',' , featureRow . CategoryVector ) } ") ;
4848
4949 // TransformedData obtained post-transformation.
5050 //
0 commit comments