Post

Replies

Boosts

Views

Activity

Tabular classification using Create ML Components
I am working on a project that involves tabular classification using Create ML Components and I'm having trouble getting my model to work correctly. I've been following the official documentation here: https://developer.apple.com/documentation/createmlcomponents/ and also i have followed the wwdc talks. This one seems to be the most relevant one: https://developer.apple.com/wwdc22/10019 In that talk the construction of a tabular regressor is explained(20:23 Tabular regressor) . I tried using BoostedTreeClassifier similar to that. I am having trouble getting it to work though. While training with 5 featureColumns and one annotation columns appears to have worked. i am unsure how to get the label (the categorical value that the model is supposed to return) after calling .predict . This is the last bit of the example from apple (tabular regression) static func predict( type: String, region: String, volume: Double ) async throws -> Double { let model = try task.read(from: parametersURL) let dataFrame: DataFrame = [ "type": [type], "region": [region], "volume": [volume] ] let result = try await model(dataFrame) return result[priceColumnID][0]! } The last line is what i am wondering how to write for a Tabular classifier. It should return a category in my case. Is there a tutorial or example for a tabular classifier code somewhere?
1
0
951
Apr ’23
swiftui: navigationsplitview crashes in landscape on ipad (ios 16.2)
Hi, i am working on an app for iphone and ipad and wanted to use NavigationSplitView. When running on an iPad in landscape orientation i am running into a crash on iOS 16.2 that i can't really understand. I followed the developer documentation and various tutorials. I am probably missing something. In this Example you can reproduce the crash on iPad in landscaope mode like this: First select "George" and then click on his book "Big Book" (last in the list for him). Then select "Luca". Click on his first book entry ("Boring book"). At this point this crashes the whole app. I get an Thread 1: EXC_BREAKPOINT (code=1, subcode=0x105c9fe94) (of course no breakpoint has been set). Any help would be greatly appreciated!! RR This is the code (you can paste it directly into a new project): // // ContentView.swift // test // import SwiftUI struct Member:Hashable, Identifiable { var id: Int var name: String } struct Book:Hashable, Identifiable { var id: Int var memberId: Int var name: String } struct ContentView: View { @State private var memberID: Member.ID? // Single selection. @State private var bookID: Book.ID? // Single selection. @State private var columnVisibility = NavigationSplitViewVisibility.all var members = [ Member(id:1, name:"George"), Member(id:2, name:"John"), Member(id:3, name:"Luca"), ] var books = [ Book(id:1,memberId:1, name:"A good Book"), Book(id:2, memberId:1, name:"Another great Book"), Book(id:3, memberId: 1, name:"Very good Book"), Book(id:4,memberId:1, name:"Lame Book"), Book(id:5, memberId:1, name:"Big Book"), Book(id:6, memberId: 2, name:"Small Book"), Book(id:7,memberId:2, name:"Green Book"), Book(id:8, memberId:2, name:"Yellow Book"), Book(id:9, memberId: 3, name:"Boring Book"), Book(id:10, memberId: 3, name:"Best Book"), ] var body: some View { NavigationSplitView(columnVisibility: $columnVisibility) { List(members, selection: $memberID) { member in HStack{ Text("ID: \(member.id)") Text("Name: \(member.name)") } } //List } content: { if memberID == nil { Text("select") } else { List(books.filter({ $0.memberId == memberID }), selection: $bookID) { book in Text(book.name) } //List } //else } detail: { Text("Details") }// detail .onChange(of: memberID){ _ in bookID = nil } } // body }
4
1
946
Mar ’23
Difficulties Integrating Core ML Model into my App
Hello, i have been working on a swift UI project and want to integrate my own ML Model from Create ML into the app. My create ML Model is a tabular-Regressor Model wich works fine in the create ML Preview. Following this guide: https://developer.apple.com/documentation/coreml/integrating_a_core_ml_model_into_your_app i have tried to integrate the model into the app (Xcode 13.4.1). I load the file into the project navigator. When i try to create the model in the code with let model = MyModelName() i get the error Cannot find 'MyModelName' in scope Other Models (like the ones downloadable from apple) seem to get recognized. I get an information about using a different init method but at least not an error. What am i doing wrong? Any ideas? Thank You ! Rob
3
0
1.1k
Jun ’22