Skip to content

Instantly share code, notes, and snippets.

@mdfarragher
Created July 23, 2020 17:47
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/dc9c559325e2ded674f8a9e8e76b4b5d to your computer and use it in GitHub Desktop.
Save mdfarragher/dc9c559325e2ded674f8a9e8e76b4b5d to your computer and use it in GitHub Desktop.
// grab five digits from the test data
let digits = context.Data.CreateEnumerable(testData, reuseRowObject = false) |> Array.ofSeq
let testDigits = [ digits.[5]; digits.[16]; digits.[28]; digits.[63]; digits.[129] ]
// create a prediction engine
let engine = context.Model.CreatePredictionEngine model
// show predictions
printfn "Model predictions:"
printf " #\t\t"; [0..9] |> Seq.iter(fun i -> printf "%i\t\t" i); printfn ""
testDigits |> Seq.iter(
fun digit ->
printf " %i\t" (int digit.Number)
let p = engine.Predict digit
p.Score |> Seq.iter (fun s -> printf "%f\t" s)
printfn "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment