Contents

MLCustomModel

An interface that defines the behavior of a custom model.

Declaration

protocol MLCustomModel

Overview

To integrate your custom model with Core ML, adopt the MLCustomModel protocol in the implementation of your custom model. If you use a Swift class for your custom implementation, make it accessible to Core ML by using the @objc(name) attribute.

@objc(MyCustomModel)
class MyCustomModel: NSObject, MLCustomModel {
  ...
}

This defines the Objective-C name for the class, which Core ML needs to access your custom class’s implementation.

Topics

Creating the model

Making predictions

Initializers