Create Second Image Use the following x_fit and y_fit data to compute z_fit by invoking the model's predict() method. This will allow you to plot the line of best fit that is predicted by the model. ]: # Plot Curve Fit from mpl_toolkits import mplot3d from matplotlib.ticker import LinearLocator, FormatStrFormatter %matplotlib inline %matplotlib notebook x_fit = np.linspace(-21, 21,1000)| y_fit = x_fit x_fit = x_fit.reshape(-1,1) y_fit = y_fit.reshape(-1,1) PolyReg LinearRegression() PolyReg.fit(x_fit, y_fit) mixData = pd.DataFrame({'x_fit': [x_fit], 'y_fit': [y_fit]}) z_fit = PolyReg. predict (mixData["x_fit"][0]) plt.scatter(x_fit, y_fit) plt.plot(x fit 7 fit C='vellow')

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter8: Working With Trendlines, Pivottables, Pivotcharts, And Slicers
Section: Chapter Questions
Problem 8EYW
icon
Related questions
Question
Create Second Image
Use the following x_fit and y_fit data to compute z_fit by invoking the model's predict() method. This will allow you to plot the line of best fit that
is predicted by the model.
7]: # Plot Curve Fit
from mpl_toolkits import mplot3d
from matplotlib.ticker import LinearLocator, FormatStrFormatter
%matplotlib inline
%matplotlib notebook
x_fit = np.linspace(-21, 21, 1000)|
y_fit = x_fit
x_fit = x_fit.reshape(-1,1)
y_fit = y_fit.reshape(-1,1)
PolyReg = LinearRegression()
PolyReg.fit(x_fit, y_fit)
mixData = pd.DataFrame({'x_fit': [x_fit], 'y_fit': [y_fit]})
z_fit = PolyReg.predict (mixData["x_fit"][0])
plt.scatter(x_fit, y_fit)
plt.plot(x_fit, z_fit, c='yellow')
Transcribed Image Text:Create Second Image Use the following x_fit and y_fit data to compute z_fit by invoking the model's predict() method. This will allow you to plot the line of best fit that is predicted by the model. 7]: # Plot Curve Fit from mpl_toolkits import mplot3d from matplotlib.ticker import LinearLocator, FormatStrFormatter %matplotlib inline %matplotlib notebook x_fit = np.linspace(-21, 21, 1000)| y_fit = x_fit x_fit = x_fit.reshape(-1,1) y_fit = y_fit.reshape(-1,1) PolyReg = LinearRegression() PolyReg.fit(x_fit, y_fit) mixData = pd.DataFrame({'x_fit': [x_fit], 'y_fit': [y_fit]}) z_fit = PolyReg.predict (mixData["x_fit"][0]) plt.scatter(x_fit, y_fit) plt.plot(x_fit, z_fit, c='yellow')
Z
500
400
300
200
100
О
О
Z
500
400
300
200
100
угаа
5
О
20
10
у
15
0
О
15
20
110
20
5
15
10
X
о
5
О
N
500
400
300
200
100
О
500
Z
О
400
300
200
100
О
О
5
прове
5
10
у
15
10
у
20
15
20
20
15
0
5
10
15
20
10
X
X
5
О
Transcribed Image Text:Z 500 400 300 200 100 О О Z 500 400 300 200 100 угаа 5 О 20 10 у 15 0 О 15 20 110 20 5 15 10 X о 5 О N 500 400 300 200 100 О 500 Z О 400 300 200 100 О О 5 прове 5 10 у 15 10 у 20 15 20 20 15 0 5 10 15 20 10 X X 5 О
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Encryption and Decryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L