data analysis with python coursera week 4 quiz answers

Practice Quiz: Linear Regression and Multiple Linear Regression

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

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

  • ‘price’
  • ‘highway-mpg’

2. consider the following equation:

the variable y is?

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

Practice Quiz: Model Evaluation using Visualization

3. Consider the following Residual Plot, is our linear model correct :

  • yes
  • incorrect

Practice Quiz: Polynomial Regression and Pipelines

4. what is the order of the following Polynomial

  • 2
  • 1
  • 3

Practice Quiz: Measures for In-Sample Evaluation

5. Consider the following lines of code; what value does the variable out contain?

lm = LinearRegression()
lm.score(X,y)
X = df[['highway-mpg']]
Y = df['price']
lm.fit(X, Y)
out=lm.score(X,y)

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

Graded Quiz: Model Development

6. What does the following line of code do?

lm = LinearRegression()

  • Fit a regression object lm
  • Create a linear regression object
  • Predict a value

7. What is the maximum value of R^2 that can be obtained?

  • 10
  • 0
  • 1

8. If X is a dataframe with 100 rows and 5 columns, and y is the target with 100 samples, and assuming all the relevant libraries and data have been imported, and the following line of code has been executed:

LR = LinearRegression()

LR.fit(X, y)

yhat = LR.predict(X)

How many samples does yhat contain?

  • 500
  • 100
  • 5

9. 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
  • Polynomial linear regression uses linear Wavelets

10. 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

Leave a Reply