Optional lab: Polynomial regression#week2#PredictedValue

Hi Mentors, FellowLearners,

In the optional lab for Feature Engineering and polynomial regression,

Please someone explain why are we using reshape on X and doing a matrix multiplication(@) with model_w (X@model_w)

x=np.arange(0,20,1)

X=x.reshape(-1,1)
X@model_w + b → predicted value

instead of simply multiplying x with model_w like below,

x*model_w + b → predicted value

while plotting the predicted value.

Reshaping is producing a column vector that is needed to plot the feature x on the 2-axis.

Check numpy reshape.

@ denotes a matrix multiplication in numpy library it gives different results from simple * operator:

https://numpy.org/doc/stable/reference/generated/numpy.matmul.html