Using the converted Core ML models in iOS

After adding the two Core ML model files, HouseLR.mlmodel and HouseSVM.mlmodel, to a new Swift-based Xcode iOS project, HouseLR.mlmodel looks like Figure 11.7:

Figure 11.7 Showing the Swift iOS project and the Linear Regression Core ML model

The other HouseSVM.mlmodel model looks exactly the same, except the Machine Learning Model Name and the Model Class are changed from HouseLR to HouseSVM.

Add the following code to class ViewController in ViewController.swift:

private let lr = HouseLR()private let svm = HouseSVM()override func viewDidLoad() {    super.viewDidLoad()     let lr_input = HouseLRInput(Bedrooms: ...

Get Intelligent Mobile Projects with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.