Supervised Learning - Prediction Week 3 Challenge
1.Perform Gradient Descent in Python with any loss function
m=0
b=0
l=0.001
epochs=1000
n = float(len(x))
for i in range(len(x)):
y_pred = m*x + b
d1 = (-2/n) * sum(x * (y-y_pred))
d2 = (-2/n) * sum(y-y_pred)
m = m-l*d1
b = b-l*d2
print(m,b)
2.Difference between L1 & L2 Gradient descent method
L1 = mean absolute error
L2 = mean square error
The mean absolute error (MAE) is a quantity used to measure how close predictions are to the outcomes. The mean absolute error is an average of the all absolute errors.
MSE is calculated by taking the average of the square of the difference between the original and predicted values of the data.
3.What are the different loss functions for regression
Loss functions for regression :
Mean Absolute Error (MAE).
Mean Absolute Percentage Error (MAPE).
Mean Squared Error (MSE).
Root Mean Squared Error (RMSE).
Huber Loss.
Log-Cosh Loss.
4.What is the importance of learning rate
LR determines the step size at each iteration while moving toward a minimum of a loss function,generally its value is 0.001
5.How to evaluate linear regression
Linear Regression can be evaluated using R Square whose value is considered to be good when its closest to 1
6.What is the difference between multiple and adjusted coefficient of determination
Multiple coefficient of determination, in statistics, R Square a measure that assesses the ability of a model to predict or explain an outcome in the linear regression setting.
The Adjusted Coefficient of Determination (Adjusted R-squared) is an adjustment for the Coefficient of Determination that takes into account the number of variables in a data set.Every time you add a data point in regression analysis, R2 will increase.