Learn practical skills, build real-world projects, and advance your career

Introduction to tensorflow and Linear regression using tensorflow:
Before we start, let me give a brief overview of what we would be covering in this discussion.
First, We will start with some basics of tensorflow. Then, we would use the tensorflow basics that we had covered to build a linear regression model for a dataset. Finally, we will see how to make use of in-built linear regression model available in the tensorflow.

Tensorflow is a open source deep learning library and is developed by google. This library consists of various off-the-shelf deep learning architectures that we can use directly use in our applications. Therefore, the users don't need to program each and every architecture separately while on the contrary, we can just call for an api present in the tensorflow and use the off-shelf architectures. Tensorflow is compatible with many different programming languages like R, Python, MATLAB, etc. Although, for now, we would be working with the python programming language. Tensorflow is used for high level machine learning application and because of the compatibility of tensorflow with both CPU nd GPU, the execution time is much faster than a traditional hand coded architecture.
Let us start by importing some of the python libraries that we will be using throughout this discussion.

import numpy as np
import pandas as pd
import tensorflow as tf

Let's begin by defining a tensor. Tensor is a multi-dimensional array which is usually used to feed the inputs and obtain the outputs from our learning algorithms.

Tensor constant:
As the name suggests, the value given to a tensor is constant and will remain unchanged. The tensor constant cannot be reassigned with a new value.
Let us start by creating a tensor constant. The keyword to create a constant is tf.constant.