Preparing your string input for machine learning processing was actually the hardest part. Getting a prediction from a machine learning model is very simple. You only need to use one simple function to get predictions from your machine learning model. With the results, populate the user interface and tell the user which gender a provided name most likely has.
- [Instructor] So far we have done everything…so that we can input our names…in a way that our model understands.…Now, we can deal with the first predictions…and get a prediction for a name.…We're going to add that in our ViewController.swift file.…I'm going to add a new function right below…the features function that we added in the last video.…I'm going to call that predictGenderFromName.…This is going to receive one perimeter,…which is a name string,…and it's going to return an optional string,…so that we could also return nil if we had to.…
Going to make some space for us here.…The first thing that we can do…is get our name features for our model.…I'm simply calling our features function…and provide it with the string…that we want to get features from,…which is our name that we have…as a parameter for this function.…That's all there is to it.…Now, the very interesting part follows,…which is the initialization of our machine learning model.…I'm defining an object for that and constant.…
All I need to do here now is to call GenderByName,…
- What are machine learning, Core ML, Vision, and NLP?
- Adding a machine learning model to a project
- Getting predictions from machine learning models
- Converting existing machine learning models for Core ML
- Classifying images and detecting objects with Vision and Core ML
- Analyzing natural language text with NSLinguisticTagger