Python Core ML

July 2017 PyJax

Who am I

  • David Fekke
  • Chief Mobile Architect for Swyft Technology
  • Formally ColdFusion/.NET/JAVA/PHP
  • Founded JaxNode user group
  • @jaxnode and @davidfekke
  • New to Python

Python & Machine Learning

  • Python and other languages like R and Julia becoming popular for Big Data analysis and Machine Learning
  • Google introduced TensorFlow 2 years ago
  • Other popular projects include Keras and Scikit

Use Cases

  • Natural Language Processing
  • Speech recognition
  • Optical Character Recognition
  • Computer Vision
  • Not Hotdog!

Core ML

  • Apple machine learning specification
  • It is a model format
  • Train models using a ML framework
  • Convert models to Core ML format

Model Types

  • Generalized Linear Models
  • Pipeline Models
  • Feature Engineering
  • Support Vector Machines
  • Tree Ensembles
  • Neural Networks

Training Models

  • Train your model with one of these frameworks
  • Keras with TensorFlow
  • Caffe
  • XgBoost
  • SciKit Learn
  • libSVM

Convert Models

import coremltools
coreml_model = coremltools.converters.caffe.convert('my_caffe_model.caffemodel')

# Now save the resulting model in the Core ML model format.'my_model.mlmodel')

Core ML Models

  • Open specification
  • They have inputs and outputs
  • They work like a function
  • Simply drag and drop model in your Xcode project

Core ML advantages

  • Does not require a data connection to run
  • Can automatically decide whether to use the CPU or the GPU for processing
  • A10 chip is as fast as 2.2GHz Core i7-5650U
  • User Privacy
  • Reduces Cloud costs

Core ML Disadvantages

  • No Federated learning
  • Can't retrain model