Data Analysis with Python Week 4 Quiz Answer

Data Analysis with Python Week 4 Quiz Answer

Data Analysis with Python 

Week 4 Quiz Answer



Practice Quiz 1

Linear Regression and Multiple Linear Regression


Q1) consider the following lines of code, what is the name of the column that contains the target values:


from sklearn.linear_model import LinearRegression 
1m=Linear regression() 
X = df[[ highway-mpg']]
Y = df['price']
lm.fit(X,Y)
Yhat=lm.predict(X)


  • 'price'
  • 'highway-mps




Q2) consider the following equation:

what is the parameter b_0 (b subscript 0)


  • the predictor or independent variable
  • the target or dependent variable
  • the intercept 
  • the slope




Practice Quiz 2

Model Evaluation using Visualization


Q1) Consider the following Residual Plot, is our linear model correct :




  • yes
  • Incorrect




Q2) Consider the following Residual Plot. is our linear model correct:



  • yes
  • No






Practice Quiz 3

Polynomial Regression and Pipelines


Q1) What functions are used to generate Polynomial Regression with more than one dimension

f=np.polyfit(x,y,3)
P=np.polyld(f)


pr=PolynomialFeatures(degree=2) 
pr.fit_transform([1,2], include_bias=False)




Q2) Select the line of code that imports the module required for polynomial features

  • from sklearn.linear_model import LinearRegression
  • from sklearn.preprocessing import PolynomialFeatures
  • from sklearn.preprocessing import StandardScaler





Practice Quiz 4

Measures for In-Sample Evaluation


Q1) Consider the following lines of code: what value does the variable out contain?


lm = LinearRegression() 

Im.score(x,y) 

X = df[['highway-mpg']] 

Y = df['price'] 

lm.fit(X, Y) 

out=1m. score(x,y)




  • The Coefficient of Determination or R^2
  • Mean Squared Error




Q2) What value of R^2 (coefficient of determination) indicates your model performs worst?


  • 1
  • 0






Practice Quiz 5

Model Development


Q1) If the predicted function is:



The method is:

  • Polynomial Regression
  • Multiple Linear Regression



Q2) What steps do the following lines of code perform?

Input=[('scale',StandardScaler()), ('model', Linear Regression())]

pipe-Pipeline(Input)

pipe.fit(2,y) 

ypipe=pipe.predict(z)



  • Standardize the data, then perform a polynomial transform on the features Z
  • Find the correlation between Z and y
  • Standardize the data, then perform a prediction using a linear regression model using the features Z and targets y




3. We create a polynomial feature as follows "PolynomialFeatures(degree=2)": what is the order of the polynomial?

  • 0
  • 1
  • 2




Q4) Which statement is true about Polynomial linear regression?

  • Polynomial linear regression is not linear in any way
  • Although the predictor variables of Polynomial linear regression are not linear the relationship between the parameters or coefficients is linear
  • Polynomiallinear regression uses linear Wavelets




Q5) The larger the mean square error, the better your model has performed

  • True
  • False




Q6) Consider the following equation:




What is the parameter b_0 (b subscript 0)?

  • The predictor or independent variable
  • The target or dependent variable
  • The intercept 
  • The slope





_____________________________________________________________


Data Analysis with Python




_____________________________________________________________





Post a Comment

1 Comments