A Neural Network fully-coded in Numpy and Tensorflow

Super simple, can’t be any easier, code provided

Assaad MOAWAD
Dec 16, 2019 · 2 min read
Image for post
Image for post

In a previous post, we explained the mechanics behind Neural networks. In this post we will show a basic implementation in pure Numpy, and in TensorFlow.

As we previously explain, neural networks execution have 4 main steps:

  1. Forward step (where we go from inputs to outputs)
  2. Loss function (where we compare the calculated outputs with real outputs)
  3. Backward step (where we calculate the first delta at the loss function and then back-propagate)
  4. Optimization step (where we update the internal weights with deltas and learning rate)
Image for post
Image for post
Neural networks step-by-step

The easiest way to do a full working example, is to take only one operator (matrix multiplication), one loss function (RMSE), one optimizer(gradient descent) and execute a full running example.

The full code can be found in Numpy here, in Tensorflow here, and a comparision between both here.

The repo is made available on GitHub as a tutorial to understand how a neural network works.

In case you still have any questions, please do not hesitate to comment or contact me at: assaad.moawad@datathings.com

I would always be glad to reply to you, improve this article, or collaborate if you have any idea in mind. If you enjoyed reading, follow us on: Facebook, Twitter, LinkedIn

DataThings

DataThings blog is where we post about our latest machine…

Assaad MOAWAD

Written by

Interested in artificial intelligence, machine learning, neural networks, data science, blockchain, technology, astronomy. Co-founder of Datathings, Luxembourg

DataThings

DataThings blog is where we post about our latest machine learning, big data analytics and neural networks experiments. Feel free to visit our website: www.datathings.com

Assaad MOAWAD

Written by

Interested in artificial intelligence, machine learning, neural networks, data science, blockchain, technology, astronomy. Co-founder of Datathings, Luxembourg

DataThings

DataThings blog is where we post about our latest machine learning, big data analytics and neural networks experiments. Feel free to visit our website: www.datathings.com

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store