我在Mac上使用游乐场以编程方式创建了一个模型,但是该模型没有更新参数。有没有人能够创建可更新的模型?我看不到任何API更改。
使用Catalina和Xcode 11 beta 3创建了模型,但是当将模型拖入项目时,生成的类不会将模型显示为可更新。
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))
}
希望建立一个可更新的模型。