CoreML — iOS Implementation for the Boston Model (part 2) — Filling the Picker

Dr J Rogel-Salazar
5 min readFeb 14, 2018

Right! Where were we? Yes, last time we put together a skeleton for the CoreML Boston Model application that will take two inputs (crime rate and number of rooms) and provide a prediction of the price of a Boston property (yes, based on somewhat all prices…). We are making use of three three labels, one picker and one button.

Let us start creating variables to hold the potential values for the input variables. We will do this in the ViewController by selecting this file from the left-hand side menu:

Inside the ViewController class definition enter the following variable assignments:

let crimeData = Array(stride(from: 0.1, through: 0.3, by: 0.01))
let roomData = Array(4...9)

These values are informed by the data exploration we carried out in an earlier post. We are going to use the arrays defined above to populate the values that will be shown in our picker. For this we need to define a data source for the picker and make sure that there are two components to choose values from.

--

--

Dr J Rogel-Salazar

Data Leader, Innovation, CIO/CTO, Machine Learning, Data Science | Dynamic professional with strong understanding of AI/ML, Data Visualisation & UX Design