For next MBS Xojo Mac64bit Plugin we add a CoreML functions to update the model on device. If you have an updatable model for CoreML, the Apple framework to use machine learning on MacOS, then you can now use our MLUpdateTaskMBS class to pass new training data to the plugin and we update the model.
You can load a model with modelWithContentsOfFile function in MLModelMBS class and you get the description with modelDescription function, you now see there a new property called trainingInputDescriptionsByName with a dictionary containing all the keys describing input parameters.
For our example model we pass a drawing parameter for the picture with 28 by 28 pixel resolution in grayscale. The other parameter is the label with the correct output for this image. We fill those parameters with the matching MLFeatureValueMBS values into a dictionary. The dictionary is then passed to a new MLDictionaryFeatureProviderMBS object.
Once you have all MLDictionaryFeatureProviderMBS objects for your training, you pass them all into a MLArrayBatchProviderMBS object. With an object from MLModelConfigurationMBS class we define whether GPU is used. Finally we pass the training data with input file to the MLUpdateTaskMBS class to run the training. We use a subclassed MLUpdateProgressHandlersMBS to catch the Progress and Completed events. And in the complete event, we can get the new model from the MLUpdateContextMBS object and write it to the new model file.
You can build solutions which come with a pre-calculated machine learning model, which is then adjusted on device (e.g. MacBook) while the user takes new data and provides correct answers. On the computer back in the office you can take a basic model to recognize some data and then adjust with all the records you have in your database.
If you are interested to use this functions, please try the 19.6pr3 release or newer. This functionality is available on MacOS 10.15 or iOS 13. Calculation happens on device using GPU if available.