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.
- This algorithm is used for making predictions when there exists a non-linear relationship between the features.
- Locally weighted linear regression is a supervised learning algorithm.
- It a non-parametric algorithm.
- doneThere exists No training phase. All the work is done during the testing phase/while making predictions.
Suppose we want to evaluate the hypothesis function
h at a certan query point
x. For linear regression we would do the following:
For locally weighted linear regression we will instead do the following:
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
xthan 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
xthe value of
w(i)can be chosen as –
Directly using closed Form solution to find parameters-
Code: Importing Libraries :
Code: Loading Data :
Code: Function to calculate weight matrix :
Code: Making Predictions:
Code: Visualise Predictions :