Skip to content

Instantly share code, notes, and snippets.

@mdfarragher
Last active July 21, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdfarragher/af26aee10dc207bd635b0eceb2e1479a to your computer and use it in GitHub Desktop.
Save mdfarragher/af26aee10dc207bd635b0eceb2e1479a to your computer and use it in GitHub Desktop.
// set up a learning pipeline
let pipeline =
EstimatorChain()
// one-hot encode all text features
.Append(context.Transforms.Categorical.OneHotEncoding("VendorId"))
.Append(context.Transforms.Categorical.OneHotEncoding("RateCode"))
.Append(context.Transforms.Categorical.OneHotEncoding("PaymentType"))
// combine all input features into a single column
.Append(context.Transforms.Concatenate("Features", "VendorId", "RateCode", "PaymentType", "PassengerCount", "TripDistance"))
// cache the data to speed up training
.AppendCacheCheckpoint(context)
// use the fast tree learner
.Append(context.Regression.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