this is week 2’s optional lab of feature engineering
pseudo code-
create target data
x = np.arange(0, 20, 1)
y = 1 + x**2
Engineer features
X = x**2 #<-- added engineered feature
X = X.reshape(-1, 1) x should be a 2-D Matrix
model_w,model_b = run_gradient_descent_feng(X, y, iterations=10000, alpha = 1e-5)
plt.scatter(x, y, marker=‘x’, c=‘r’, label=“Actual Value”); plt.title(“Added x**2 feature”)
plt.plot(x, np.dot(X,model_w) + model_b, label=“Predicted Value”); plt.xlabel(“x”); plt.ylabel(“y”); plt.legend();
why is reshaping being done here when both y and x are already of same dimensions?