Skip to content

Commit b863ac2

Browse files
jwood803sfilipi
authored andcommitted
Update cookbook (#2494)
* Switch OneHotEncoding parameters * Fix table of contents * Update for spacing
1 parent 069abb7 commit b863ac2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/code/MlNetCookBook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,11 @@ var catColumns = data.GetColumn<string[]>(mlContext, "CategoricalFeatures").Take
688688
// Build several alternative featurization pipelines.
689689
var pipeline =
690690
// Convert each categorical feature into one-hot encoding independently.
691-
mlContext.Transforms.Categorical.OneHotEncoding("CategoricalFeatures", "CategoricalOneHot")
691+
mlContext.Transforms.Categorical.OneHotEncoding("CategoricalOneHot", "CategoricalFeatures")
692692
// Convert all categorical features into indices, and build a 'word bag' of these.
693-
.Append(mlContext.Transforms.Categorical.OneHotEncoding("CategoricalFeatures", "CategoricalBag", CategoricalTransform.OutputKind.Bag))
693+
.Append(mlContext.Transforms.Categorical.OneHotEncoding("CategoricalBag", "CategoricalFeatures", CategoricalTransform.OutputKind.Bag))
694694
// One-hot encode the workclass column, then drop all the categories that have fewer than 10 instances in the train set.
695-
.Append(mlContext.Transforms.Categorical.OneHotEncoding("Workclass", "WorkclassOneHot"))
695+
.Append(mlContext.Transforms.Categorical.OneHotEncoding("WorkclassOneHot", "Workclass"))
696696
.Append(mlContext.Transforms.FeatureSelection.CountFeatureSelectingEstimator("WorkclassOneHot", "WorkclassOneHotTrimmed", count: 10));
697697

698698
// Let's train our pipeline, and then apply it to the same data.

0 commit comments

Comments
 (0)