Basics of TensorFlow to get you started.
TensorFlow is an Open-Source, Machine Learning framework to build, deploy and analyze your ML Models. This article is for someone who knows Deep Learning (Math and Theory), preferably gone through the deeplearning.ai course or something similar.
Here you will get to understand the basic working of TensorFlow and how your Data in “Tensor” format, “Flows” through the computation graph. It always an advantage to think of your model visually on a computation graph.
Before jumping into the core, let's look at some of the Hyperparameters for the model, such as
- Learning Rate: This constant helps your Optimizer to compute new weights based on the weights of the previous iteration.
- Batch Size: Batch size is a term used in machine learning and refers to the number of training examples utilized in one iteration.
- Epochs: An epoch is one complete presentation of the data set, so if you have 1000 samples and 100 as your batch size, 1 Epoch will have 10 iterations.
Generally, the input data is passed through the layers of our network, which gives a corresponding loss which is then reduced by our optimizer, we can then evaluate performance by training.
Every ML Project can be broken down into its smaller core components, such as
- Input(Data): Usually inputs are a set of data and their corresponding labels, defined using placeholders(promise values).
- Layers: A layer is usually a composite of 2 or 3 components, A transform function (eg Dense, Convolution) and a Nonlinearity function also called as an activation function (eg Relu, Sigmoid, Tanh) and dropout, these components can be further broken down to their respective weights and biases.
- Loss: Here we compute the cost, or we measure how inaccurate our model is, and compare it with the ground truth values.
- Optimizer: An Optimizer is a function which we use to minimize the loss(cost) of our network, It generally uses some flavor of Gradient decent or in more practical scenarios uses Stochastic Gradient Descent, wrapped as Adam or Adagrad or RMSProp
- Evaluation: Is this section we calculate the correct values predicted and find out the accuracy of our model.
- Training: In the above steps we only construct the network and define the parameters, here we execute the training in batches using the batch size and then push the data to the model to train.
Let's look at the code
The general takeaway from this blog is the different components of a model, also for beginners when going through research papers look for these 6 parts, as they will help in understanding the paper.