Usage of the above formula?

Can the closed-form solution formula be used for multivariate linear regression, or only gradient descent algorithm can be used?

Hi,
Both Gradient Descent and Closed Form solution are the ways to find thetas. No. of features doesn’t matter in any of the case. The difference between both is Gradient Descent is iterative approach, while closed form is analytical method.
So, Yes, you can apply closed form in Multivariate as well.
But most of times closed form will not work if the data is non linear (you will see the non linear dataset from next section).
Moreover, closed form is very expensive, and in the age where datasets are continuously growing, no one would like to spend resources on this approach…
So, it’s better to use Gradient Descent. :smile:

1 Like

Sure but since the no of features in multivariate linear regression increases, the size of x-train and y-train are different, and hence i am not able to get a plot…Could you help me with this

Okay,
Suppose you want to plot house price data set where in X you have only 1 feature i.e size of house and y is price of house

On X axis you can have size var. and y axis you can have price. Can you visualize the plotted graph? For every point in x-axis there will be one point in y-axis…

But if you have 2 variable (features) for house price dataset. X1 = size of house X2 = num of bedrooms. you will plot these variables on x and y axis right… but where will you put the price of each data point… Here you might be thinking Z-axis. I would say you can do that, but you will not get anything if you see the plot. It will be very difficult to understand the 3 Dimensional graph…

So to conclude, we can’t visualize the dataset in that such case.
However if you see the result of dataset (multi features) from closed form and gradient descent, both are very very similar.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.