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.
Related
I am trying to deploy a pretrained model on a android application . Now, the need is to retrain the model with the data captured locally.
Specifically what is happening is, There is a pretrained dnn model which predicts the quality of a video seeing the bandwidth. The neural network was trained on some data which had the bandwidth and the corresponding video quality. Now that model has to be deployed on device for retraining on the new data.
This new data is already captured via a mobile application and is stored in required format(csv) .
First i thought of using tflite but it does not support on device retraining.
Now i am trying to use DL4J but could not understand how to do it.
If it possible to use DL4J in this case then how can i do it.
If not, then is there a another approach.
ps. I have tried my best to write the problem statement clearly. Pardon me, if u find it difficult to understand. Please comment what u have not understood, i will clear it.
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 it possible to ship an iOS app with a CoreML model and then have the app continue improving (training) the model on device based on user behaviour for example? So, then the model would keep growing and improving right on the device with no need of a server support...
It's now possible with Core ML 3.
https://developer.apple.com/videos/play/wwdc2019/704/
Skip to 9:00 to see it in action. If you just want the code, skip to 13:50.
The answer is YES.
Since CoreML 3 is greatly optimised – the answer is YES, you can train a CoreML model on device when your app is running.
However, using CoreML 2 it's not possible to train a model on device, because running CoreML 2 app, considerably much power is required to train a model in comparison with CoreML 3. That's why desktop and cloud computers with power GPUs are used for creating a pre-trained models. In CoreML 2 your MLmodel must be pre-configured and you have to include all pre-processing techniques like Edge Detection or Frame Differencing at that stage.
I'm trying to do the same thing. Apparently, when you convert your model to Core ML format with coremltools, you can pass the "respect_trainable" argument to the converter and it will automatically make the model updatable.
Is there any in-cloud deep-learning solutions that makes data predictions?
For example, user may write some text into text field and algorithm (deep learning code)
should suggest one of 8 categories based on input.
If it suggests wrong variant - user may select correct one, and algorithm should improve itself
in real-time without new app’s release. Also learning model should be shared between users.
Or another example:
User writes some text into field, and algorithm improves that text based on trained input.
Is there are any solutions for that available right now on iOS?
Which is the best for price/value?
Update: CoreML is not an option because it doesn't share model and requires app release to update the model.
It seems to me that what you are looking for can be covered by Core ML, starting in iOS 11.
Here you have 2 links to the WWDC talks:
Introducing Core ML
Core ML in depth
The first step is for you to build a Core ML model.
Hope this helps
In my limited knowledge of the new Core ML framework, I understand that the model is build in to the bundle.
I was sure that ML and models evolve over time, collecting more data to furthere evolve the model. If that is true, why is the Core ML framework then using "static" models?
I can see that for speed needed for computer vision(object recognition etc.), but the model should be able to evolve reading from http something - right?
CoreML is not made to train the model on the mobile device, but to run a trained model in the app.
It's still true that you might improve your model over time and might want to be able to update it without having to submit a new app.
There has been some discussion on that: https://stackoverflow.com/a/44463680/2054629 and I don't have a real answer on why Apple didn't made easy to update a model as long as it takes the same input and has the same output types.