Skip to content

Latest commit

 

History

History
109 lines (69 loc) · 4.36 KB

Module 4 - Model Development.md

File metadata and controls

109 lines (69 loc) · 4.36 KB

Learning Objectives

  • Describe how to process linear regression in Python
  • Apply model evaluation using visualization in Python
  • Apply polynomial regression techniques to Python
  • Evaluate a data model by using visualization
  • Describe the use of R-squared and MSE for in-sample evaluation
  • Apply prediction and decision making to Python model creation

Practice Quiz: Linear Regression and Multiple Linear Regression

Question 1: Consider the following lines of code, what variable contains the predicted values:

3-1

  • A. [ ] X
  • B. [X] Yhat
  • C. [ ] Y

Question 2: Consider the following equation:

3-2

The variable y is?

  • A. [X] the target or dependent variable
  • B. [ ] the predictor or independent variable
  • C. [ ] the intercept

Practice Quiz: Model Evaluation using Visualization

Question 1: Consider the following Residual Plot, is our linear model correct:

3-3

  • A. [X] Yes
  • B. [ ] Incorrect

Practice Quiz: Polynomial Regression and Pipelines

Question 1: what is the order of the following Polynomial

3-5

  • A. [ ] 1
  • B. [ ] 2
  • C. [X] 3

Practice Quiz: Measures for In-Sample Evaluation

Question 1: Consider the following lines of code; what value does the variable out contain?

3-6

  • A. [ ] Mean Squared Error
  • B. [X] The Coefficient of Determination or R^2

Lesson Summary

In this lesson, you have learned how to:

  • Define the explanatory variable and the response variable: Define the response variable (y) as the focus of the experiment and the explanatory variable (x) as a variable used to explain the change of the response variable. Understand the differences between Simple Linear Regression because it concerns the study of only one explanatory variable and Multiple Linear Regression because it concerns the study of two or more explanatory variables.
  • Evaluate the model using Visualization: By visually representing the errors of a variable using scatterplots and interpreting the results of the model.
  • Identify alternative regression approaches: Use a Polynomial Regression when the Linear regression does not capture the curvilinear relationship between variables and how to pick the optimal order to use in a model.
  • Interpret the R-square and the Mean Square Error: Interpret R-square (x 100) as the percentage of the variation in the response variable y that is explained by the variation in explanatory variable(s) x. The Mean Squared Error tells you how close a regression line is to a set of points. It does this by taking the average distances from the actual points to the predicted points and squaring them.

Model Development

Model Development

Graded Quiz: Model Development

Question 1: What does the following line of code do?

lm = LinearRegression()
  • A. [X] Create a linear regression object
  • B. [ ] Fit a regression object lm
  • C. [ ] Predict a value

Question 2: What is the maximum value of R^2 that can be obtained?

  • A. [X] 1
  • B. [ ] 0
  • C. [ ] 10

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

  • A. [ ] 0
  • B. [ ] 1
  • C. [X] 2

Question 4: Which statement is true about Polynomial linear regression?

  • A. [ ] Polynomial linear regression is not linear in any way
  • B. [ ] Polynomial linear regression uses linear Wavelets
  • C. [X] Although the predictor variables of Polynomial linear regression are not linear the relationship between the parameters or coefficients is linear

Question 5: Consider the following equation:

3-2

The variable y is what?

  • A. [X] The target or dependent variable
  • B. [ ] The intercept
  • C. [ ] The predictor or independent variable