1. What will be output of this Python code: import numpy as np import matplotlib.pyplot as plt x = np.array([1, 2, 3, 4, 5]) y = np.array([4, 2, 1, 3, 7]) plt.scatter(x, y); 2. What will be output of this Python code for the same data as above, from sklearn.linear_model import LinearRegression X=x[:, np.newaxis] model LinearRegression().fit(x, y) = yfit = model.predict(X) plt.scatter(x, y) plt.plot(x, yfit);
1. What will be output of this Python code: import numpy as np import matplotlib.pyplot as plt x = np.array([1, 2, 3, 4, 5]) y = np.array([4, 2, 1, 3, 7]) plt.scatter(x, y); 2. What will be output of this Python code for the same data as above, from sklearn.linear_model import LinearRegression X=x[:, np.newaxis] model LinearRegression().fit(x, y) = yfit = model.predict(X) plt.scatter(x, y) plt.plot(x, yfit);
Related questions
Question
![1. What will be output of this Python code:
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1, 2, 3, 4, 5])
y = np.array([4, 2, 1, 3, 7])
plt.scatter(x, y);
2. What will be output of this Python code for the same data as above,
from sklearn.linear_model import LinearRegression
X = x[:, np.newaxis]
model = LinearRegression().fit(x, y)
yfit=model.predict(X)
plt.scatter(x, y)
plt.plot(x, yfit);](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa38b1750-4836-4d47-bfc9-b05e81f0daae%2Fcc12913c-dc1c-4e99-84d0-bde0cf404317%2Fhxcc3ui_processed.png&w=3840&q=75)
Transcribed Image Text:1. What will be output of this Python code:
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1, 2, 3, 4, 5])
y = np.array([4, 2, 1, 3, 7])
plt.scatter(x, y);
2. What will be output of this Python code for the same data as above,
from sklearn.linear_model import LinearRegression
X = x[:, np.newaxis]
model = LinearRegression().fit(x, y)
yfit=model.predict(X)
plt.scatter(x, y)
plt.plot(x, yfit);
![3. What will be output of this Python code
from numpy import nan
X = np.array([[nan, 0, 3 ],
[3,7,9],
[3,5,2],
[4, nan, 6],
[8, 8, 1]])
y = np.array([14, 16, -1, 8, -5])
from sklearn.preprocessing import Imputer
imp = Imputer(strategy='mean')
X2 = imp.fit_transform(X)
X2](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa38b1750-4836-4d47-bfc9-b05e81f0daae%2Fcc12913c-dc1c-4e99-84d0-bde0cf404317%2Ffpabvz_processed.png&w=3840&q=75)
Transcribed Image Text:3. What will be output of this Python code
from numpy import nan
X = np.array([[nan, 0, 3 ],
[3,7,9],
[3,5,2],
[4, nan, 6],
[8, 8, 1]])
y = np.array([14, 16, -1, 8, -5])
from sklearn.preprocessing import Imputer
imp = Imputer(strategy='mean')
X2 = imp.fit_transform(X)
X2
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 3 images
