5

I programmatically created a model using a playground on Mac but the model does not have the update parameters. Has anyone been able to create an updatable model? I do not see any API changes to do so.

Created the models using Catalina and Xcode 11 beta 3 but when the model is pulled into a project the generated class does not show the model as being updatable.

        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))
        }

Hoping to build an updatable model.

adev
  • 2,052
  • 1
  • 21
  • 33
Art Cube
  • 51
  • 1

0 Answers0