Question: The shape of the input features: 4 4 2 , 1 0 ? , The shape of the output varaible: 4 4 2 , ?
"The shape of the input features:
"The shape of the output varaible:
# Load the diabetes dataset
"diabetes diabetes datasets.LoaddiabetesreturnXyTrue
"printThe shape of the input features: diabetesX shape In
"printThe shape of the output varaible: diabetes yshape
# Use only one feature
"diabetesXone diabetesX: npnewaxis,
"printdiabetesXone.shape
## Dataset split
In
"Now, we split the dataset into two parts: training set and test set.
In
training set: samples
test set: samples
"Assume that we have a hypothesis $$ theta theta x $
In
"Your tasks: In
In
IMPORTANT Do not just call the least square function from libraries, for example,
"scipy.optimize.leastsquares from scipy. Doing so will result in point. Using helping functions such as numpy.linalg.inv is okay. In
In
NOTE Notice that the loss function is meansquared error. In
pts derive the analytical expression of the gradient if the loss is defined as
theta $$
In
To check whether your computation is correct, consider using an API such as Scikit learn linearregression."
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
