Using TensorFlow on CloudxLab

We are glad to inform you that the TensorFlow is now available on CloudxLab. In this example, we will walk you through a basic tutorial on how to use TensorFlow.

What is TensorFlow?
TensorFlow is an Open Source Software Library for Machine Intelligence. It is developed and supported by Google and is being adopted very fast.

What is CloudxLab?
CloudxLab provides a real cloud-based environment for practicing and learn various tools. You can start learning right away by just signing up online.

In this blog, we will go through a slight deviation of the first example of TensorFlow in the stepwise fashion as mentioned here. The objective of the exercise is to figure out the straight line that fits the given data. A line is characterized by the slope and intercept. In other words, we need to figure out the line that best suits the following points.

Fitted Line

The end result of this exercise is to figure out the blue line as shown in the graph below:

Fitted Line

Step 0: Login into cloudxLab

See this video to know how to login into the console.

Step 1: Start python interactive shell

Type “python” (without quotes) command on shell

Step 2: import libraries needed

Step 3: Generate Some random data

Step 4: Define the variables that we need to figure out

Step 5: Define relation between them – For simplicity we are assuming relation to be linear

Step 6: Define Loss function

 Step 7: Define the algorithm that we want to use.

Step 8: Initialize

Step 9: Launch

Step 10: Try to fit the line 250 times

Step 11: Understand the result

The above command will produce the results somewhat like this:

You can see that it has learned after 220 iterations that the best fit is W: [0.09999362] and b: [0.30012295]. So, the equation of the best line that fits the above points is y = x*0.09999362 + 0.30012295

If you plot this line along with the points, you would get a plot like this:

Fitted Line

Practice TenserFlow now on CloudxLab