Binary Classification Model training in CoreML - ios

I have just started exploring CoreML and was wondering if there is a way to train a Binary Classification Model using the same.
Please provide me any references or examples as I am a ML noob.

Core ML doesn't offer any APIs for building or training models. It works with models you've already trained elsewhere (Keras, Caffe, etc) to perform whatever prediction or classification task you built the model for. See Apple's Core ML docs for info on how to convert a model for use with Core ML.

Core ML offers building and training models as of macOS 10.14 (Mojave). In XCode you can train models in various ways.
I don't believe they currently support a binary classifier, but if you can build an image set of X and NOT X you could emulate such.
Apple's Docs: https://developer.apple.com/documentation/create_ml/creating_an_image_classifier_model

Related

Ml.Net Imageclassification incremental learning

Is Ml.net image classification trainer support incremental learning or not and if yes can anybody show me example or topic to read it
If by incremental learning you're referring to taking the weights from a trained model and using that as the starting point to continue training, it's not supported at the moment. Technically though you're not starting from scratch with the image classification trainer since you're using transfer learning to train the last layer of the chosen pretrained image classification network, but incremental learning on your trained model is currently not supported. I would suggest posting an issue in the repo requesting this feature so others who may want this feature as well are able to upvote / comment on it.
https://github.com/dotnet/machinelearning/issues/new/choose

CoreML on-device model training with tabular data

I'm trying to build an app that makes suggestions (distinct classes) based on a table with 4 features: latitude, longitude, time and weekday.
The training data of my app is 100% personal, so it doesn't really make sense to pre-train the model. I wanna be able to train on device. I know CoreML 3 supports updating for neural networks and kNN classifiers, but does this really help me with my tabular data?
Other tabular classifiers like boasted tree, random forest... can't be trained on device unfortunately. Are there alternatives to CoreML for on device training of those simpler machine learning algorithms? Or can CoreML somehow already do what I want.
Unfortunately I'm not really an expert in neural networks.
Just because Core ML doesn't provide something, doesn't mean it's impossible. :-) You can use existing libraries or implement the algorithm by yourself.
If you're looking to build a logistic regression classifier, this is fairly easy to implement by hand. (You can even use a neural network with a single layer for this and still use Core ML.)

Is there a way to train a TensorFlow model on iOS?

The documentation for porting an already trained TensorFlow Model to iOS is well defined:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/ios
However, nowhere is mentioned if the model:
can be further trained on the device, or
can be created from scratch and trained on the device
Is this possible with TensorFlow?
I am aware of other Swift/C++ libraries that offer on-device training, but I am more interested in this technology.
Starting with CoreML3 and the UpdatableTask, the training on device is now part of the API: https://developer.apple.com/documentation/coreml/mlupdatetask

Dynamic Machine Learning Model for iOS

I have an iOS app written in SWIFT. It gets user information and saves it in the database (Firebase). I want to use this data and then dynamically update the Machine Learning model created as the data updates to provide an improved prediction every time. Is there a way of doing this?
I know that I can create my trained model separately (e.g. using TensorFlow) and then use Core ML to import it into my app but how can I do this so the model keeps updating as new data comes in?
Thanks for the help!!
Depends on the model.
You cannot use Core ML for this as it does not support training. The Metal Performance Shaders framework in iOS 11.3 now supports training for neural network-based models. And you can always write your own training code.
If the model is something basic like a logistic regression, you can train it on the device and it won't take that long. If it's a deep learning model with many layers and you're training it on a lot of data, it might not be feasible to train on the device.

Training and prediction via Tensorflow

I have just started coding with TensorFlow and I have classified Images.
Is there any possibility of making a prediction based on testing data?
How can I predict missing value based on the model?
Question
Does Tensorflow have the capability to read training data and test data from two separate files?
Answer
Yes! Here is an example of processing Iris data, an intro machine learning data set for Tensorflow.
If you look at the code you will see the following lines
IRIS_TRAINING = "iris_training.csv"
IRIS_TEST = "iris_test.csv"
The data is clearly separated into training and test files. You don't have to separate your data into different files in Tensorflow, but it certainly supports it and this tutorial link shows how to do it.

Resources