The API
for Human Beings
Haritha Thilakarathne
François Chollet
What is
• High Level neural network API
• Written in Python
• Integration with TensorFlow, Theano & CNTK.
• (MXNet backend for Keras on the way!)
Keras API spec
TensorFlow
TensorFlow
workflow
Theano CNTK
Why
• Fast prototyping
• Supports CNN, RNN & combination of both
• Modularity
• Easy extensibility
• Simple to get started, simple to keep going
• Deep enough to build serious models.
• Well-written document.
• Runs seamlessly on CPU and GPU.
Easy to turn Models into Products
• On iOS, via Apple’s CoreML
• On Android, via the TensorFlow Android runtime.
• In the browser, via GPU-accelerated JavaScript runtimes such
as Keras.js and WebDNN.
• On Google Cloud, via TensorFlow-Serving.
• In a Python webapp backend (such as a Flask app).
• On the JVM, via DL4J model import provided by SkyMind.
• On Raspberry Pi.
General Design Idea of
1. Prepare your inputs and output tensors
2. Create first layer to handle input tensor
3. Create output layer to handle targets
4. Build virtually any model you like in between
Keras Pipeline
Define Network
Compile Network
Fit Network
Evaluate Network
Make Predictions
Layers & Layers in
• Regular dense, MLP type
• Recurrent layers, LSTM, GRU, etc.
• Convolution 1D
• Convolution 2D
Activations in
• More or less all your favorite activations are available:
• Sigmoid, tanh, ReLu, softplus, hard sigmoid, linear
• Advanced activations implemented as a layer.
• Advanced activations: LeakyReLu, PReLu, ELU, Parametric
Softplus, Thresholded linear and Thresholded Relu
Objectives & Optimizers in
• Objective Functions:
• Error loss: rmse, mse, mae, mape, msle
• Hinge loss: squared hinge, hinge
• Class loss: binary crossentropy, categorical crossentropy
• Optimization:
• Provides SGD, Adagrad, Adadelta, Rmsprop and Adam
• All optimizers can be customized via parameters
http://haritha.me
@naadiya007

Introduction to keras

  • 2.
    The API for HumanBeings Haritha Thilakarathne
  • 6.
  • 9.
    What is • HighLevel neural network API • Written in Python • Integration with TensorFlow, Theano & CNTK. • (MXNet backend for Keras on the way!)
  • 10.
  • 11.
    Why • Fast prototyping •Supports CNN, RNN & combination of both • Modularity • Easy extensibility • Simple to get started, simple to keep going • Deep enough to build serious models. • Well-written document. • Runs seamlessly on CPU and GPU.
  • 12.
    Easy to turnModels into Products • On iOS, via Apple’s CoreML • On Android, via the TensorFlow Android runtime. • In the browser, via GPU-accelerated JavaScript runtimes such as Keras.js and WebDNN. • On Google Cloud, via TensorFlow-Serving. • In a Python webapp backend (such as a Flask app). • On the JVM, via DL4J model import provided by SkyMind. • On Raspberry Pi.
  • 13.
    General Design Ideaof 1. Prepare your inputs and output tensors 2. Create first layer to handle input tensor 3. Create output layer to handle targets 4. Build virtually any model you like in between
  • 14.
    Keras Pipeline Define Network CompileNetwork Fit Network Evaluate Network Make Predictions
  • 15.
    Layers & Layersin • Regular dense, MLP type • Recurrent layers, LSTM, GRU, etc.
  • 16.
    • Convolution 1D •Convolution 2D
  • 17.
    Activations in • Moreor less all your favorite activations are available: • Sigmoid, tanh, ReLu, softplus, hard sigmoid, linear • Advanced activations implemented as a layer. • Advanced activations: LeakyReLu, PReLu, ELU, Parametric Softplus, Thresholded linear and Thresholded Relu
  • 18.
    Objectives & Optimizersin • Objective Functions: • Error loss: rmse, mse, mae, mape, msle • Hinge loss: squared hinge, hinge • Class loss: binary crossentropy, categorical crossentropy • Optimization: • Provides SGD, Adagrad, Adadelta, Rmsprop and Adam • All optimizers can be customized via parameters
  • 22.