a) Discuss about quadratic cost / mean squared error. (2 Marks) Quadratic cost, or Mean Squared Error (MSE), is one of the simplest cost functions primarily used for regression tasks. It measures the performance of a model by calculating the squared difference between the true label (yi) and the predicted output (y^i). Formula: C=1ni=1n(yiy^i)2 Squaring the difference serves two purposes:

  1. It ensures the difference always remains positive.

  2. It severely penalizes large errors compared to smaller ones.

b) Point out the benefit or importance of using cross entropy cost function. (3 Marks) Benefits of the Cross Entropy cost function include:

  1. It helps to minimize the impact of saturated neurons on learning speed, allowing the network to learn faster.

  2. It is relatively easy to compute and optimize.

  3. It is robust to outliers in the data.

  4. It is well-suited and highly effective for multi-class classification tasks.

c) Using this one-dimensional quadratic function f(x)=2x2+4x+2 find the second step of gradient. [η=0.1,x0=5], [Pn+1=Pnηf(Pn)] (5 Marks)

Solution: Given, Function, f(x)=2x2+4x+2 Learning rate, η=0.1 Starting point, x0=5

First, we need to find the derivative (gradient) of the function: f(x)=ddx(2x2+4x+2)=4x+4

The gradient descent update rule is: xn+1=xnηf(xn)

Step 1 - Finding x1: Gradient at x0=5 is f(x0)=4(5)+4=20+4=24 So, x1=x0ηf(x0) x1=5(0.1×24) x1=52.4 x1=2.6

Step 2 - Finding x2: Gradient at x1=2.6 is f(x1)=4(2.6)+4=10.4+4=14.4 So, x2=x1ηf(x1) x2=2.6(0.1×14.4) x2=2.61.44 x2=1.16

Answer: The second step of gradient is 1.16.

Powered by Forestry.md