-
-
Save mdfarragher/99696298eb7207c34feaf3145d372b0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build a training pipeline | |
let pipeline = | |
EstimatorChain() | |
// step 1: map the number column to a key value and store in the label column | |
.Append(context.Transforms.Conversion.MapValueToKey("Label", "Number", keyOrdinality = ValueToKeyMappingEstimator.KeyOrdinality.ByValue)) | |
// step 2: concatenate all feature columns | |
.Append(context.Transforms.Concatenate("Features", "PixelValues")) | |
// step 3: cache data to speed up training | |
.AppendCacheCheckpoint(context) | |
// step 4: train the model with SDCA | |
.Append(context.MulticlassClassification.Trainers.SdcaMaximumEntropy()) | |
// step 5: map the label key value back to a number | |
.Append(context.Transforms.Conversion.MapKeyToValue("Number", "Label")) | |
// train the model | |
let model = trainData |> pipeline.Fit | |
// the rest of the code goes here.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment