TensorFlow

published on 02 February 2023

An open-source machine learning framework famous for powering deep neural networks with high-level code it was developed by the google brain team and first released in 2015. It's most commonly used with Python but can run in other languages like JavaScript, C++, and Java.

1-ezh11

At its core, it's just a library for programming with linear algebra and statistics. As you know, the word tensor describes a multilinear relationship between sets of algebraic objects within a vector space, AKA, a multi-dimensional array what makes it special is its collection of APIs for Data Processing, Visualization Model, Evaluation, and Deployment that makes deep learning accessible to the average developer.

2-9p5vy

It's extremely portable and is able to run on tiny mobile CPUs or microcontrollers with TensorFlow lite. It can run in the browser with tensorflow.js while the core library can scale up to multiple GPUs or run on tensor processing units ships engineered specifically to run TensorFlow at a massive scale. 

It's used in medicine for object detection and MRI images by Twitter to sort your timeline by tweet relevance, by Spotify to recommend music, and by PayPal for fraud detection. It is in addition to many other applications like self-driving cars natural language processing, and so on, to build your own neural network right now, create a python file, and install TensorFlow.

Next, we'll need some data like fashion which we can automatically import. The goal is to train a model that can predict the clothing type of each image. Tensorflow has a subclassing API for expert users but also integrates with the beginner-friendly Keras library, which has a sequential API that can easily build neural networks layer by layer.

3-rdpn9

We start with a flattened layer that takes the 28 by 28-pixel image as an input and converts it into a one-dimensional array this input layer is then fed into a dense layer with 128 fully connected neurons or nodes you can think of each node like its own linear regression as each data point flows through it it'll try to guess the output and gradually update a mapping of weights to determine the importance of a given variable.

4-4d6ig

In this case, it uses a rectified linear activation function that will output the input if a certain threshold is met. Otherwise, it will just output zero and the behavior of this layer can be customized by tuning as hyperparameters.

5-t34mk

Finally, we have our output layer which is also dense but is limited to 10 nodes which correspond to the total number of clothing types in the data set.

6-2iyjw

Now we can compile the model and tell it to optimize a certain loss function like sparse categorical cross-entropy. As we train the model for multiple epochs its accuracy should gradually improve.

7-un9ax

The end result is a model that makes a prediction with the likelihood that an image is a certain type of clothing. Congratulations! You just built a neural network. 

Key Takeaways: 

1. TensorFlow is an open-source machine learning framework developed by the Google Brain team and first released in 2015. 

2. It is most commonly used with Python but can run in other languages like JavaScript, C++, and Java. 

3. It integrates with the beginner-friendly Keras library, which has a sequential API that can easily build neural networks layer by layer. 

4. It uses a rectified linear activation function that will output the input if a certain threshold is met. 

5. The end result is a model that makes a prediction with the likelihood that an image is a certain type of clothing.

Read more