When we have more than one input feature, how do you compute the cost function? (Read the question very clearly so that you could clearly understand what I meant).

Hello @Paila_Dileep_Sai,

Let’s say you have only one sample, and -

- when you have one feature, you calculate it by J = \frac{1}{2}(w_1x_1 + b - y)^2
- when you have two features, J = \frac{1}{2}(w_1x_1 + w_2x_2 + b - y)^2
- when you have n features, J = \frac{1}{2}(w_1x_1 + w_2x_2 + ... +w_nx_n + b - y)^2

Raymond

1 Like