Do we have to add the offset while implementing logistic regression and regularized logistic regression?
In the lab template, there is a line adding offset to tx matrix in the logistic regression and the regularized logistic regression:
tx = np.c_[np.ones((y.shape[0], 1)), x]
Do we have to add this offset while implementing logistic regression and regularized logistic regression in project 1?
Also, do we have to add the offset to other four functions?
It is okay to similarly add tx = np.c_[np.ones((y.shape[0], 1)), x]
as a preprocessing step for your data matrix tx and then use generic logistic / least-squares functions (without any changes inside them) on the extended data matrix.
Do we have to add the offset while implementing logistic regression and regularized logistic regression?
In the lab template, there is a line adding offset to tx matrix in the logistic regression and the regularized logistic regression:
Do we have to add this offset while implementing logistic regression and regularized logistic regression in project 1?
Also, do we have to add the offset to other four functions?
Thanks!
It is okay to similarly add
tx = np.c_[np.ones((y.shape[0], 1)), x]
as a preprocessing step for your data matrix
tx
and then use generic logistic / least-squares functions (without any changes inside them) on the extended data matrix.Add comment