The error metric (the quitean appropriate term used in the question title) quantifies the fitness of a model (linearlinear or otherwise) as a scalar valuenonlinear model.
It aggregates individual errors across a set of observations (instances of inputtraining data). In typical use, an error function is applied to the difference between the dependent variable vector predictions ofpredicted by the model and theempirical observations. These differences are calculated for each instance of dependent variable vector inputobservation and then summed.
The dimensions of the independent and dependent variable vectors are, in machine learning, conventionally called features and labels respectively. 1
Closed forms are convenient when one wants to quickly and easily calculate slope and intercept in linear regression. 12
An intuitive understanding of gradient descent can be gained by considering a thirsty, blind person looking for water on land solely by taking calculated steps. (In software, these steps are iterations.) The blind person can only sense the direction of the altitude gradient (direction of slope) with their feet to descend to a local minimum altitude. 23
Anyone stating that, "The function itself does not matter," in relation to the usual applications of gradient descent would be a dangerous choice for guide in a blind hiking expedition. For instance, the reciprocal of distance as an error function would likely lead to the dehydration and death of the hikers. The
The selection criteria for error metrics is important if one is interested in the speed of convergence on a solution or whether the solution will ever be found. 34
The statement, "The result should be positive so positive and negative deviations are still counted," is incorrect. 45
[1] The dimensions of a model's independent and dependent variable vectors are, in machine learning, conventionally called features and labels respectively.
[2] Another smooth function, such as the error to the fourth power would also lead to closed forms for slope and intercept, although they would produce slightly different results if the correlation coefficient is non-zero.
[2][3] Gradient descent algorithms in general do not guarantee finding a global minimum. In the example given, it would be quote possible to miss a small hole exists with water in it. Depending on the surface features (terrain), sensing the angle of the foot (determining gradient) can be counterproductive. The search can becomes chaotic. To extend the intuitive analogy, consider searching for the bottom of the stairs in Escher's Relativity lithograph.
[3][4] For an error metric to be likely to converge and therefore useful in regression regardless of the direction of the error the sign of the metric is irrelevant. It is each of the set of partial derivatives of the error metric with respect to the corresponding set of distances between the model predictions and observations that should be positive to regress omnidirectionally. It sounds more complicated, but even this corrected statement is an oversimplification.
[4][5] The error metric in gradient descent applications is often calculated using a convex function to avoid overshoot and possible oscillation and non-convergence. In some cases error functions other that sum of squares is used. The choice of function has to do with a number of factors: (1) the model to which the data is to be fit, (2) the factors expected to affect or actually affecting deviations of the observations (training data) from the model, and (3) computational resources relative to the size of the data set.
- The model to which the data is to be fit
- Factors expected to affect or actually affecting deviations of the observations (training data) from the model
- Computational resources relative to the size of the data set