I am creating model with Create ML. I am using a JSON file.
let data = try MLDataTable(contentsOf: URL(fileURLWithPath: "poems.json"))
let (trainingData , testingData) = data.randomSplit(by: 0.8, seed: 0)
let classifier = try MLRegressor(trainingData: data, targetColumn: "author", featureColumns: ["text"])
let metadata = MLModelMetadata(author: "ffffff", shortDescription: "sdhkgfjhsgdjfhgs", license: nil, version: "1.0", additional: nil)
try classifier.write(to: URL(fileURLWithPath: "poems.mlmodel"), metadata: metadata)
The JSON file looks like this
{"title":"When You Are Old",
"author":"William Butler Yeats",
"text":"When you are old and grey and full of sleep,\nAnd nodding by the fire, take down this book,\nAnd slowly read, and dream of the soft look\nYour eyes had once, and of their shadows deep;\nHow many loved your moments of glad grace,\nAnd loved your beauty with love false or true,\nBut one man loved the pilgrim Soul in you,\nAnd loved the sorrows of your changing face;\nAnd bending down beside the glowing bars,\nMurmur, a little sadly, how Love fled\nAnd paced upon the mountains overhead\nAnd hid his face amid a crowd of stars."}
Following a tutorial I am trying to do a text detection on the "text" and return the possible "author"
I can make that but I would like to have also the probability.
Creating the model with Create ML, as a Text Classifier I get only output a label: Author. Is there a way with Create ML to have also probability in Text Classification?
Thanks