Linear Regression: Machine Learning Interview Prep 01

Shahidullah Kawsar
4 min readSep 24, 2020

Linear regression is like drawing a straight line through data points to understand their relationship. It helps us predict one variable based on another. For example, we can predict house prices based on their size. The algorithm finds the best-fitting line by minimizing the differences between predicted and actual values. This line then serves as a predictive model for future data.

Let’s check your basic knowledge of linear regression, the most commonly used machine learning algorithm. Here are 10 multiple-choice questions for you and there’s no time limit. Have fun!

Question 1: A linear regression model assumes “a linear relationship between the input variables and the single output variable.” What’s the meaning of this assumption?
(A) The output variable can’t be calculated from a linear combination of the input variables
(B) The output variable can be calculated from a linear combination of the input variables
(C) Input variables can be calculated from a linear combination of the output variables
(D) Output variable = sum of the input variables

Question 2: In a simple linear regression problem, a single input variable (x) and a single output variable (y), the linear equation would be y = ax + b; where a and b are _______ and ________ respectively. (select two)
(A) bias Coefficient, feature coefficient
(B) feature coefficient, bias Coefficient
(C) slope, y-intercept
(D) y-intercept, slope

Question 3: For a regression line through the data, the vertical distance from each data point to the regression line is called residual. (i) Square the residual, and (ii) sum all of the squared errors together. This is the quantity that ordinary least squares seek to _____?
(A) minimize
(B) maximize
(C) increase
(D) None of these

Question 4: For a linear regression model, start with random values for each coefficient. The sum of the squared errors is calculated for each pair of input and output values. A learning rate is used as a scale factor and the coefficients are updated in the direction of minimizing the error. The process is repeated until a minimum sum squared error is achieved or no further improvement is possible. This technique is called ______?
(A) Gradient Descent
(B) Ordinary Least Squares
(C) Homoscedasticity
(D) Regularization

Question 5: Which parameter determines the size of the improvement step to take on each iteration of Gradient Descent?
(A) learning rate
(B) epoch
(C) batch size
(D) regularization parameter

Question 6: One of the major assumptions of linear regression: when the variance around the regression line is the same for all values of the predictor variable is called _____?
(A) L1 regularization
(B) Lasso Regression
(C) Homoscedasticity
(D) Heteroscedasticity

Question 7: For a Linear Regression model, we choose the coefficients and the bias term by minimizing the _____.
(A) Loss function
(B) Error function
(C) Cost function
(D) All of the above

Question 8: Which one is the correct Linear regression assumption?
(A) Linear regression assumes the input and output variables are not noisy
(B) Linear regression will over-fit your data when you have highly correlated input variables
(C) The residuals (true target value − predicted target value) of the data are normally distributed and independent from each other
(D) All of the above

Question 9: In a linear regression model, which technique can find the coefficients?
(A) Ordinary Least Squares
(B) Gradient Descent
(C) Regularization
(D) All of the above

Question 10: Which one is the disadvantage of Linear Regression?
(A) The assumption of linearity between the dependent variable and the independent variables. In the real world, the data is not always linearly separable
(B) Linear regression is very sensitive to outliers
(C) Before applying Linear regression, multicollinearity should be removed because it assumes that there is no relationship among independent variables.
(D) All of the above

The solutions will be published in the next quiz Machine Learning Quiz 02: Ridge, Lasso. Happy learning. If you like the questions and enjoy taking the test, please subscribe to my email list for the latest ML questions, follow my Medium profile, and leave a clap for me. Feel free to discuss your thoughts on these questions in the comment section. Don’t forget to share the quiz link with your friends or LinkedIn connections. If you want to connect with me on LinkedIn: my LinkedIn profile.

Photo: Big Bend National Park, TX, USA Credit: Tasnim and Kawsar

--

--