![]() |
VOOZH | about |
LOESS or LOWESS are non-parametric regression methods that combine multiple regression models in a k-nearest-neighbor-based meta-model. LOESS combines much of the simplicity of linear least squares regression with the flexibility of nonlinear regression. It does this by fitting simple models to localized subsets of the data to build up a function that describes the variation in the data, point by point.
Suppose we want to evaluate the hypothesis function h at a certain query point x. For linear regression we would do the following:
For locally weighted linear regression we will instead do the following:
where w(i) is a is a non-negative “weight” associated with training point x(i). A higher “preference” is given to the points in the training set lying in the vicinity of x than the points lying far away from x. so For x(i) lying closer to the query point x, the value of w(i) is large, while for x(i) lying far away from x the value of w(i) is small.
w(i) can be chosen as -
Directly using closed Form solution to find parameters-
Code: Importing Libraries :
Code: Loading Data :
Output:
Code: Function to calculate weight matrix :
Code: Making Predictions:
Code: Visualise Predictions :
👁 Image