@@ -303,8 +303,8 @@ var someRows = mlContext
303303// This will give the entire dataset: make sure to only take several row
304304// in case the dataset is huge. The is similar to the static API, except
305305// you have to specify the column name and type.
306- var featureColumns = transformedData .GetColumn <string []>(mlContext , " AllFeatures" )
307- . Take ( 20 ). ToArray ();
306+ var featureColumns = transformedData .GetColumn <string []>(transformedData . Schema [ " AllFeatures" ] )
307+
308308```
309309## How do I train a regression model?
310310
@@ -637,7 +637,7 @@ var pipeline =
637637var normalizedData = pipeline .Fit (trainData ).Transform (trainData );
638638
639639// Inspect one column of the resulting dataset.
640- var meanVarValues = normalizedData .GetColumn <float []>(mlContext , " MeanVarNormalized" ).ToArray ();
640+ var meanVarValues = normalizedData .GetColumn <float []>(normalizedData . Schema [ " MeanVarNormalized" ] ).ToArray ();
641641```
642642
643643## How do I train my model on categorical data?
@@ -682,8 +682,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
682682// Load the data.
683683var data = loader .Load (dataPath );
684684
685- // Inspect the first 10 records of the categorical columns to check that they are correctly load .
686- var catColumns = data .GetColumn <string []>(mlContext , " CategoricalFeatures" ).Take (10 ).ToArray ();
685+ // Inspect the first 10 records of the categorical columns to check that they are correctly read .
686+ var catColumns = data .GetColumn <string []>(data . Schema [ " CategoricalFeatures" ] ).Take (10 ).ToArray ();
687687
688688// Build several alternative featurization pipelines.
689689var pipeline =
@@ -699,8 +699,8 @@ var pipeline =
699699var transformedData = pipeline .Fit (data ).Transform (data );
700700
701701// Inspect some columns of the resulting dataset.
702- var categoricalBags = transformedData .GetColumn <float []>(mlContext , " CategoricalBag" ).Take (10 ).ToArray ();
703- var workclasses = transformedData .GetColumn <float []>(mlContext , " WorkclassOneHotTrimmed" ).Take (10 ).ToArray ();
702+ var categoricalBags = transformedData .GetColumn <float []>(transformedData . Schema [ " CategoricalBag" ] ).Take (10 ).ToArray ();
703+ var workclasses = transformedData .GetColumn <float []>(transformedData . Schema [ " WorkclassOneHotTrimmed" ] ).Take (10 ).ToArray ();
704704
705705// Of course, if we want to train the model, we will need to compose a single float vector of all the features.
706706// Here's how we could do this:
@@ -756,8 +756,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
756756// Load the data.
757757var data = loader .Load (dataPath );
758758
759- // Inspect the message texts that are load from the file.
760- var messageTexts = data .GetColumn <string >(mlContext , " Message" ).Take (20 ).ToArray ();
759+ // Inspect the message texts that are read from the file.
760+ var messageTexts = data .GetColumn <string >(data . Schema [ " Message" ] ).Take (20 ).ToArray ();
761761
762762// Apply various kinds of text operations supported by ML.NET.
763763var pipeline =
0 commit comments