Challenge

Supervised Learning - Prediction Week 3 Challenge

Q1. Perform Gradient Descent in Python with any loss function.

Ans. Calculate the loss = h - y and maybe the squared cost (loss^2)/2m. Calculate the gradient = X' * loss / m. Update the parameters theta = theta - alpha * gradient.

Q1. Difference between L1 & L2 Gradient descent method.

Ans. From a practical standpoint, L1 tends to shrink coefficients to zero whereas L2 tends to shrink coefficients evenly. L1 is therefore useful for feature selection, as we can drop any variables associated with coefficients that go to zero. L2, on the other hand, is useful when you have collinear/codependent features.

Q3. What are the different loss functions for regression.

Ans. Loss functions used in Regression:

  • Mean Squared Error/L2 Loss: This is the most used loss function as it is very easy to understand and implement. ...
  • Mean Absolute Error / L1 Loss: ...
  • Root Mean Squared Error: ...
  • Mean Bias Error: ...
  • Huber Loss:

Q4. What is the importance of learning rate.

Ans4. The range of values to consider for the learning rate is less than 1.0 and greater than 10^-6. A traditional default value for the learning rate is 0.1 or 0.01, and this may represent a good starting point on your problem.

Q5. How to evaluate linear regression.

Ans. Evaluation of Linear Regression Model

  1. R Square/Adjusted R Square.
  2. Mean Square Error(MSE)/Root Mean Square Error(RMSE)
  3. Mean Absolute Error(MAE)
  4. illustrate Residual of model as a normal distribution ( bell shape)
  5. By OLS from statemodels.formula.

Q6. What is the difference between multiple and adjusted coefficient of determination.

Ans. The fundamental point is that when you add predictors to your model, the multiple Rsquared will always increase, as a predictor will always explain some portion of the variance. Adjusted Rsquared controls against this increase, and adds penalties for the number of predictors in the model.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.