@@ -303,8 +303,8 @@ var someRows = mlContext
303
303
// This will give the entire dataset: make sure to only take several row
304
304
// in case the dataset is huge. The is similar to the static API, except
305
305
// 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
+
308
308
```
309
309
## How do I train a regression model?
310
310
@@ -637,7 +637,7 @@ var pipeline =
637
637
var normalizedData = pipeline .Fit (trainData ).Transform (trainData );
638
638
639
639
// 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 ();
641
641
```
642
642
643
643
## How do I train my model on categorical data?
@@ -682,8 +682,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
682
682
// Load the data.
683
683
var data = loader .Load (dataPath );
684
684
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 ();
687
687
688
688
// Build several alternative featurization pipelines.
689
689
var pipeline =
@@ -699,8 +699,8 @@ var pipeline =
699
699
var transformedData = pipeline .Fit (data ).Transform (data );
700
700
701
701
// 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 ();
704
704
705
705
// Of course, if we want to train the model, we will need to compose a single float vector of all the features.
706
706
// Here's how we could do this:
@@ -756,8 +756,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
756
756
// Load the data.
757
757
var data = loader .Load (dataPath );
758
758
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 ();
761
761
762
762
// Apply various kinds of text operations supported by ML.NET.
763
763
var pipeline =
0 commit comments