I am currently attempting to run a program that uses Swift's Core and Create ML frameworks for machine learning. My model is set up, but I'm having difficulty setting up a function that calculates the output I want. If it helps, I am using a tutorial, linked here. Around 4:50, he starts to write the code segment 'prediction' that gives me the error. I've tried looking at similar cases but I'm still not sure what I'm doing wrong and as I'm pretty much a complete beginner in Swift and Swift ML, a simple solution would be appreciated! I've attached code segments to show exactly what is giving me the error, hopefully that helps!
func calculateSpoilageDay() {
do {
let model: BananaSpoilageCalc = try BananaSpoilageCalc(configuration: .init())
let prediction = try model.prediction(percentbrown: Int(percentbrown), liquidleaking: Int(liquidleaking), nummoldspot: Int(nummoldspots)) //error No exact matches in call to instance method 'prediction' here
} catch {
alertTitle = "Error"
alertMessage = "Sorry, there was a problem calculating the number of days until your bananas spoiled."
}
showingAlert = true
}
Beginning of Code (instance data):
import SwiftUI
import CoreML
...
@State private var percentbrown = Int()
@State private var liquidleaking = Int()
@State private var nummoldspots = Int()
@State private var alertTitle = ""
@State private var alertMessage = ""
@State private var showingAlert = false