Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with Machine Learning

Getting Started with Machine Learning

Software is eating the world and ML is going to eat software. Many developers, both young and seasoned, want to get started with Machine Learning.

This is my deck for a talk I gave at Google Developer Group DevFest, 2018 at New Delhi. The main points covered are:

* ML Applications
* Neural Networks
* Tools
* Training your first classifier
* Resources
* Next Steps

Avinash Hindupur

October 28, 2018
Tweet

More Decks by Avinash Hindupur

Other Decks in Technology

Transcript

  1. Agenda • ML Applications • Neural Networks • Tools •

    Train your first classifier • Resources • Next Steps
  2. Applications • Image Classification • Neural style transfer on images

    and videos • Visual Question Answering • Image and Video Captioning • Text generation from a prompt • Story based question answering • Image generation - GANs • Games, deep RL
  3. Tensorflow TensorFlow is an open source software library for numerical

    computation using data flow graphs. • Nodes - mathematical operations • Edges - multidimensional data arrays (tensors)
  4. Keras Keras is a high-level neural networks API. Written in

    Python and capable of running on top of TensorFlow, CNTK, or Theano. • Allows for easy and fast prototyping • Supports both CNNs and RNNs, as well as combinations of the two. • Runs seamlessly on CPU and GPU.
  5. Training your first classifier • Load Data • Define Model

    • Compile Model • Fit Model • Evaluate Model • Predict
  6. Loading Data Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz 32768/29515 [=================================] - 0s

    0us/step Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz 26427392/26421880 [==============================] - 1s 0us/step Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-labels-idx1-ubyte.gz 8192/5148 [===============================================] - 0s 0us/step Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-images-idx3-ubyte.gz 4423680/4422102 [==============================] - 0s 0us/step
  7. Loading Data • Fashion-MNIST • 70,000 grayscale images • 10

    categories • Each image is 28x28 Fashion-MNIST, Zalando
  8. Explore Data train_images.shape (60000, 28, 28) len(train_labels) 60000 train_labels array([9,

    0, 0, ..., 3, 0, 5], dtype=uint8) test_images.shape (10000, 28, 28) len(test_labels) 10000 'T-shirt/top' 'Trouser' 'Pullover' 'Dress' 'Coat' 'Sandal' 'Shirt' 'Sneaker' 'Bag' 'Ankle boot'
  9. Preprocess Data plt.figure(figsize=(10,10)) for i in range(25): plt.subplot(5,5,i+1) plt.xticks([]) plt.yticks([])

    plt.grid(False) plt.imshow(train_images[i], cmap=plt.cm.binary) plt.xlabel(class_names[train_labels[i]])
  10. Fit Model Epoch 1/5 60000/60000 [==============================] - 5s 90us/step -

    loss: 0.5001 - acc: 0.8253 Epoch 2/5 60000/60000 [==============================] - 5s 88us/step - loss: 0.3761 - acc: 0.8644 Epoch 3/5 60000/60000 [==============================] - 5s 89us/step - loss: 0.3384 - acc: 0.8759 Epoch 4/5 60000/60000 [==============================] - 5s 89us/step - loss: 0.3124 - acc: 0.8857 Epoch 5/5 60000/60000 [==============================] - 5s 86us/step - loss: 0.2946 - acc: 0.8922
  11. Predict predictions = model.predict(test_images) predictions[0] array([4.0652740e-06, 6.9819279e-08, 2.5388722e-06, 1.3390627e-07, 1.1847248e-07,

    2.9022932e-02, 2.0918555e-06, 6.4492501e-02, 9.1468155e-06, 9.0646631e-01], dtype=float32) np.argmax(predictions[0]) 9
  12. Predict # Plot the first X test images, their predicted

    label, and the true label # Color correct predictions in blue, incorrect predictions in red num_rows = 5 num_cols = 3 num_images = num_rows*num_cols plt.figure(figsize=(2*2*num_cols, 2*num_rows)) for i in range(num_images): plt.subplot(num_rows, 2*num_cols, 2*i+1) plot_image(i, predictions, test_labels, test_images) plt.subplot(num_rows, 2*num_cols, 2*i+2) plot_value_array(i, predictions, test_labels)
  13. Resources • Deep Learning Book - A free practical book

    on deep learning by Ian Goodfellow • Fast AI course - ML crash course for coders • Deep Learning AI - Learn deep learning from Andrew Ng • Deep Hunt - A newsletter on latest developments in ML • Tensorflow Tutorials - Official guides
  14. What can you do next? • Keep practising - Kaggle,

    Open Source • Do online courses • Read blogs • Follow important researchers • Be active in community