Skip to content

Instantly share code, notes, and snippets.

@mdfarragher
Created July 22, 2020 20:53
Show Gist options
  • Save mdfarragher/a3315286e9c987fe02968727b2d20ede to your computer and use it in GitHub Desktop.
Save mdfarragher/a3315286e9c987fe02968727b2d20ede to your computer and use it in GitHub Desktop.
// set up a training pipeline
let pipeline =
EstimatorChain()
// step 1: convert the label value to a boolean
.Append(
context.Transforms.CustomMapping(
Action<HeartData, ToLabel>(fun input output -> output.Label <- input.Diagnosis > 0.0f),
"LabelMapping"))
// step 2: concatenate all feature columns
.Append(context.Transforms.Concatenate("Features", "Age", "Sex", "Cp", "TrestBps", "Chol", "Fbs", "RestEcg", "Thalac", "Exang", "OldPeak", "Slope", "Ca", "Thal"))
// step 3: set up a fast tree learner
.Append(context.BinaryClassification.Trainers.FastTree())
// train the model
let model = partitions.TrainSet |> 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