Is it possible to create and updatable model in code?

I am creating a model from an MLDataTable as such:


if let dataTable = try? MLDataTable(dictionary: priorityData) {

let (trainingCSVData, testCSVData) = dataTable.randomSplit(by: 0.8, seed: 0)

print( "Training Data = " + trainingCSVData.description)

do {

let deleteProbabilityClassifier = try MLClassifier(trainingData: dataTable, targetColumn: "DeleteProbability")

// evaluate it

let metrics = deleteProbabilityClassifier.evaluation(on: testCSVData)

let modelMetadata = MLModelMetadata(author: "Me", shortDescription: "Model for DeleteProbability Prediction", version: "1.1")

let modelPath = homeDirURL.appendingPathComponent(name + "-deleteProbabilityPredictor.mlmodel", isDirectory: false)

do {

try deleteProbabilityClassifier.write(to: modelPath, metadata: modelMetadata)

print("Success - DeleteProbability Model written" + modelPath.absoluteString )

print(metrics)

return true

}

catch {

print("Failure to write DeleteProbabilityClassifier - " + modelPath.absoluteString)

}

}

catch {

print("ML Classifier failed")

print("ML Classsifier threw error = " + error.localizedDescription)

}

}

else {

print("Failed - MLDataTable ")

print(type(of: priorityData))

}


What do I need to do to update this code to generate an updatable model? Currently I am running this code within a playground. I do not see any where to set the isUpdatable to true here?


Any help would be greatly appreciated.


Thanks,

Rob

Is it possible to create and updatable model in code?
 
 
Q