Question: Create a randon one dimensional dataset x = np . arange ( 0 , 1 0 0 ) y = x + np . random.rand
Create a randon one dimensional dataset
x nparange
y x nprandom.rand
pltscatterxy
Problem
a Fit a regression line on the dataset created above using sklearn.linearmodel LinearRegression, use default hyperparameters
b Print out the regression intercept and coefficients
c Plot the data in blue and the regression line in red
d Predict the y value for x and show it on the plot in green.
Problem
a Fit a regression line on the dataset created above using tensorflow and keras, use default hyperparameters, sequential model, one dense neuron, activation'linear'. Use 'rmsprop' optimizer and mean squared error for the loss function. Use epochs.
b Print out the regression intercept and coefficients
c Plot the data in blue and the regression line in red
d Predict the y value for x and show it on the plot in green
e Print the coefficients in the keras model and compare to the scikit learn modelen
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
