Machine Learning - Celsius to Fahrenheit
Tags: machinelearning, beginners, computerscience
Published: 2020-01-17 15:14:16

---
title: Machine Learning - Celsius to Fahrenheit
published: true
description: Machine Learning studies
cover_image: https://i.ibb.co/SQv2JZN/terminator-genisys-2.jpg
tags: machinelearning, Beginners ,Computer Science
series: Making Of Terminator
---
Hey I am here with the second part,

So let's start with a problem.
Suppose you were given the following input and output values.
                        
![details](https://i.ibb.co/NWN0KvK/examples.png)

So when you input a value of 0 you get an output value of 32.
8 -> 46.4
15 -> 59 and so on.

Take a closer look at these numbers and let me ask you a question.

Can you figure out what will be the output value if you put in 38 as the input value?

38 -> ?

 ![sd](https://media.giphy.com/media/WpaVhEcp3Qo2TjwyI1/giphy.gif)

If you answered 100.4, you are correct.

<code>F =  C * 1.8 + 32</code> right?

<ul>
<li>Where the input refers to degrees in Celsius and are represented here by a letter C</li>
<li>The outputs refer to degrees Fahrenheit represented here by the letter F</li> <li>In other words the inputs represent a temperature value in degrees Celsius and the outputs show the corresponding temperature in degrees Fahrenheit.</li>
</ul>

For example, an input value of 0 refers to a temperature of 0 degrees Celsius,
which corresponds to 32 degrees Fahrenheit.

We get 32 by multiplying 0 by 1.8 and adding 32 like we see here in this equation.

Similarly, an input value of 15 refers to a temperature of
15 degrees Celsius which corresponds to 59 degrees Fahrenheit.
We get 59 by multiplying 15 by 1.8 and adding 32 like we see here in this equation.

<code>What your brain just did to figure out the relation between these particular inputs and outputs, that's exactly what machine learning does.</code>

That is, given a set of inputs and their corresponding outputs,the machine-learning algorithms will figure out the correct algorithm to convert the inputs to the outputs.You can think of it this way, <code>in traditional software development, the input and the algorithm is known and you write a function to produce an output. On the other hand with machine learning, the input and the output are known but the algorithm that creates the output given the input is not known.So in machine learning the algorithm has to be learned.</code>
Let's see an example.

Suppose you wanted to write a computer program that can convert degrees Celsius to degrees Fahrenheit using the relation F equals C times 1.8 plus 32.
With traditional software development, <code>this relation can be easily implemented in any programming language by using a function.</code>
In Python for example, this function will look like this.

![code](https://i.ibb.co/1st0GTL/python.png)

Here the function takes the input value C. Then computes the output value F using the explicit algorithm that you wrote down and finally returns the output value F. On the other hand, in the machine learning approach we have the input and the output but not the algorithm. So it looks something like  above. The machine learning approach consists of using a neural network to learn the relation between these inputs and outputs. 

<code>You can think of a neural network as a stack of layers where each layer consists of some predefined Math and internal variables.The input value is fed to the neural network and follows through the stack of layers. The Math and the internal variables are applied to it and the resulting output is produced.In order for the neural network to learn the correct relationship between the inputs and the outputs, we have to train it. </code>

We train our neural network by repeatedly letting the network try to map the input to the output. While training, tuning the internal variables in the layers until the network learns to produce the output given the inputs.  <code>As we will see, the training process to teach the network to tune it's internal variables is performed for thousands or even millions of iterations over the input and the output data.</code>

In very simple terms,you can think of the machine learning algorithm as a function that can tune variables in order to correctly map some inputs to some outputs.

![machine learning](https://i.ibb.co/RgqDGkF/machine.png)

Let us continue this to another one.