Slide 1

Slide 1 text

Peter-John Welcome GDE Firebase @pjapplez The life cycle of building Machine Learning enabled features on mobile An Introduction to ML life cycle on mobile

Slide 2

Slide 2 text

Half screen photo slide if text is necessary Who I am Freelance Mobile Engineer Google Developer Expert for Firebase

Slide 3

Slide 3 text

Data-driven vs ML-driven

Slide 4

Slide 4 text

Data-driven vs ML-driven

Slide 5

Slide 5 text

Data-driven vs ML-driven

Slide 6

Slide 6 text

Will ML add unique value?

Slide 7

Slide 7 text

Will ML add value Yes Developer could write a bunch of if statements or doing word searches but maintain that will become unmaintainable.

Slide 8

Slide 8 text

● Recognize class entities ● Recommend content ● Natural language understanding ● Predicting future events (forecasting) ● Etc. https://pair.withgoogle.com/guidebook/ Examples of ML adding value

Slide 9

Slide 9 text

● Automating high value tasks ● Providing static information to user. ● Providing transparency. ● Etc. https://pair.withgoogle.com/guidebook/ Examples of ML !adding value

Slide 10

Slide 10 text

The ML life cycle

Slide 11

Slide 11 text

ML Life Cycle

Slide 12

Slide 12 text

ML Decision Pyramid https://www.youtube.com/watch?v=pm_-pVPvZ-4

Slide 13

Slide 13 text

● Data wrangling. ● Making it accessible in some kind of database/warehouse/data lake. ● Trying to use the data to solve the problem. Data collection and labelling

Slide 14

Slide 14 text

● Tensorflow ( Google’s open source ML platform) ● CoreML (Apples ML platform) ● Cloud-based approach. Training our model

Slide 15

Slide 15 text

Training our model Tensorflow lite An open source machine learning platform for on-device inference Cloud , Google colab , on personal machine Python and Swift Has support for Android, iOS, IOT device etc https://medium.com/dvt-engineering/will-swift-take-over-python-as-the-go-to-language-for-ml-ff9f8d9d7141 https://www.tensorflow.org/lite

Slide 16

Slide 16 text

Training our model CoreML Machine learning platform by Apple thats optimized for on device ML and leverages Apple hardware Supports only iOS devices CoreML does have a converter to convert Tensorflow and Pytorch models to coreML CreateML is an Xcode bundled ML tool to create coreml models https://developer.apple.com/machine-learning/core-ml/

Slide 17

Slide 17 text

Training our model Cloud based - API Google Cloud, Amazon, Azure all provide us the ability to train ML models in the cloud and deploy them. We could create a REST API or there are products that can generate REST API’s

Slide 18

Slide 18 text

● Better accuracy ● Preventing Bias ● Feature importance Optimize

Slide 19

Slide 19 text

● Tensorflow Lite Converter ● CoreML Converter import tensorflow as tf converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) tflite_model = converter.convert() open("converted_model.tflite", "wb").write(tflite_model) https://www.tensorflow.org/lite/guide/get_started#2_convert_the_model_format https://coremltools.readme.io/docs Converting

Slide 20

Slide 20 text

● Models are intellectual property ● Once the model is deployed its in the users hands. ● Obfuscation ● Model encryption ( weights, architecture, format scrambling) ● Hybrid processing ( processing data before inputting it into the model) Encrypt and Protect

Slide 21

Slide 21 text

● On-Device models helps with privacy ● Faster inference/predictions ● Bloat app ( App size ) ● Updating model requires updating the app as its bundled. ● REST API can be used by then it requires network and violates user privacy ● Remote deployment of models with Firebase or ML deployment (iOS) Deployment

Slide 22

Slide 22 text

● This is the hardest part on the process ● Analytics ● User Testing, A/B Testing ● UX is really important at this point in how the user interacts with the model ● Being aware of privacy when collecting data ● Making sure model is not Bias ● Explained really well in the People and AI guide book https://pair.withgoogle.com/guidebook/ Monitoring

Slide 23

Slide 23 text

On-device ML Using transfer learning Being able to update/retraining parts a model This helps with personalization CoreML on iOS and Tensorflow lite on Android both support this. Great for privacy

Slide 24

Slide 24 text

References ● https://www.tensorflow.org/lite ● https://developer.apple.com/machine-learning/core-ml/ ● https://pair.withgoogle.com/guidebook/ ● https://firebase.google.com/docs/ml/manage-hosted-models ● https://www.fritz.ai/

Slide 25

Slide 25 text

Peter-John Welcome GDE Firebase @pjapplez Thank You!