Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started