Interface MLCustomModel


  • public interface MLCustomModel
    Protocol for specifying a custom model implementation. API-Since: 12.0
    • Method Detail

      • initWithModelDescriptionParameterDictionaryError

        @Nullable
        @Nullable MLCustomModel initWithModelDescriptionParameterDictionaryError​(@NotNull
                                                                                 @NotNull MLModelDescription modelDescription,
                                                                                 @NotNull
                                                                                 @NotNull NSDictionary<java.lang.String,​?> parameters,
                                                                                 @Nullable
                                                                                 @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Initialize the custom model implementation. The model description describes the input and output feature types and metadata in the Model specificaiton. The parameter dictionary contains the contents of the 'parameters' map from the CustomModel specification. This function is called once on model load. We expect the implementation to return 'nil' and set an error in the event of failure initializing the object.
      • predictionFromFeaturesOptionsError

        @Nullable
        @Nullable MLFeatureProvider predictionFromFeaturesOptionsError​(@NotNull
                                                                       @NotNull MLFeatureProvider input,
                                                                       @NotNull
                                                                       @NotNull MLPredictionOptions options,
                                                                       @Nullable
                                                                       @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Required implemenationat of a single sample input prediction.
      • predictionsFromBatchOptionsError

        @Nullable
        default @Nullable MLBatchProvider predictionsFromBatchOptionsError​(@NotNull
                                                                           @NotNull MLBatchProvider inputBatch,
                                                                           @NotNull
                                                                           @NotNull MLPredictionOptions options,
                                                                           @Nullable
                                                                           @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Batch prediction with explicit options, if not implemented the single input predictionFromFeatures:options:error will be used