Difficulty: beginner
Estimated Time: 15 minutes

Machine Learning problems can most of the times be rephrased as the optimisation problems. The whole point is to define a proper function to be optimised.

This scenario is walking you through how to perform the optimisation using TensorFlow.

## Congratulations!

You've completed Function Optimisation scenario.

You've completed the following tasks for both quadratic function and linear model:

• Defining the loss function
• Initialising the optimiser
• Function optimisation

### Optimising the function

Step 1 of 4

#### Loss function

The goal of optimisation problem is to find the values that minimise or maximise the value of the loss function. TensorFlow is making this process more comfortable than we had the chance to observe in the Neural Network training scenario.

The first function we'll deal with is going to be the quadratic function: You can see its plot below: The function has the minimum (of value -1) in the point 5. This one happens to have the analytical solution, but it's not usually the case. In the situation like this, you should use the math instead of the iterative optimisation process. Nonetheless, we will use the TensorFlow, for learning.

To start working with TensorFlow use the following command:

`python`

And import the library:

`import tensorflow as tf`

To define the function in TensorFlow, we will use tf.Variable for x starting from the value -10. Then we'll set up the function itself.

```x = tf.Variable(-10., dtype=tf.float32) y = x**2 - 10*x + 24```

Terminal