data driven code

18
Hacker’s Guide to Neural Networks a. k. a. Data Driven Code – 101 Anoop Thomas Mathew @atmb4u PyCon Canada 2016

Upload: anoop-thomas-mathew

Post on 22-Jan-2018

579 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Data Driven Code

Hacker’s Guide to Neural Networksa. k. a.

Data Driven Code – 101Anoop Thomas Mathew

@atmb4u

PyCon Canada 2016

Page 2: Data Driven Code

WHAT WE WILL NOT COVER

• Recent developments in • United States of America! ;) • Deep Learning, CNN, RNN, DCGAN etc.• Frameworks like TensorFlow, Theano, Keras etc.

• Advanced concepts of neural networks

Page 3: Data Driven Code

WHAT WE WILL COVER

• Basic Concepts of • Parameter Optimization• Entropy (Sparse Coding)

• Little bit of Mathematics• Linear Algebra – Matrix Multiplication• Differential Calculus – Sigmoid Function (2 equations only)

• (Try to) Build a 2 layer neural network• Way Forward

Page 4: Data Driven Code

PARAMETER OPTIMIZATION

• Infinite Monkey Theorem

• Any problem is fundamentally a parameter optimization problem

𝑎𝑥3 + 𝑏𝑥2 + 𝑐𝑥 + 𝑑 = 0

Page 5: Data Driven Code

0/1

noise bit

data bits

28 = 256Imagine: • divided into 4 spaces• each bit – a feature• generalize data bits • attenuates noise bit

ENTROPY

0/1

0/1

• Sparse Coding

Page 6: Data Driven Code

LITTLE LINEAR ALGEBRA

𝑤1 𝑤2𝑤3 𝑤4

× 𝑥1𝑥2

= 𝑤1𝑥1+ 𝑤2𝑥2𝑤3𝑥1+ 𝑤4𝑥2

Page 7: Data Driven Code

LITTLE LINEAR ALGEBRA (matrix multiplication)

𝑤1 𝑤2𝑤3 𝑤4

× 𝑥1𝑥2

= 𝑤1𝑥1 + 𝑤2𝑥2𝑤3𝑥1 + 𝑤4𝑥2

Page 8: Data Driven Code

ACTIVATION FUNCTION (differential calculus part)

σ(x) = /

1+e−x

(Sigmoid Function)

0∂σ(x)02 = σ(x)×(1−σ(x))

(Derivative of Sigmoid Function)

Stochastic Gradient Decent

Page 9: Data Driven Code

QUICK RECAP

• Activation Function (combining inputs to a representation)

• Layers (Weight Matrices)

• Network (collection of weight matrices)

• Dataset (inputs and expect outputs)

• Features (patterns in dataset)

• Sparse Encoding (room for error)

• Backpropagation (learn from past mistakes)

• Parameter Optimization (correct values into weight matrix)

Page 10: Data Driven Code

LET’S MAKE ONE NOW !

CODE + DATA = MAGIC(Teach machine XOR truth table)

Page 11: Data Driven Code

XOR GATE

Page 12: Data Driven Code

SHOW ME THE CODE

Page 13: Data Driven Code
Page 14: Data Driven Code

DEEP LEARNING

Page 15: Data Driven Code

DEEP LEARNING

Page 16: Data Driven Code

WAY FORWARD

Play with Neural networks in the browser

http://playground.tensorflow.org/

Comprehensive list of resources available online on Deep Learning

https://github.com/ChristosChristofidis/awesome-deep-learning

Very active online Machine Learning Communityhttps://www.kaggle.com/

Page 17: Data Driven Code

REFERENCE LINKS / IMAGE COURTESY

• https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1

• https://medium.com/technology-invention-and-more/how-to-build-a-multi-layered-neural-network-in-python-53ec3d1d326a#.dis92by0e

• http://iamtrask.github.io/2015/07/12/basic-python-network/

• http://iamtrask.github.io/2015/07/27/python-network-part2/

• http://sebastianraschka.com/faq/docs/logisticregr-neuralnet.html

Page 18: Data Driven Code

THANK YOU // [email protected]

• Code - https://github.com/atmb4u/data-driven-code

• Slides – https://slideshare.net/atmb4u/data-driven-code

• Medium - https://medium.com/@atmb4u/data-driven-code-101-17003f7b88ec