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
P=np.polyld(f)
- 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
- 0
- 1
- 2
- 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
- True
- False
- The predictor or independent variable
- The target or dependent variable
- The intercept
- The slope
_____________________________________________________________
Data Analysis with Python
_____________________________________________________________
1 Comments
Nice article 👍
ReplyDelete