Loess from scratch in Python + Animation
Introduction Loess is a class of regression models that allows us to estimate the regression function f(X) by fitting a simple (and different) model to each point in the domain X. This is done by paying attention to the points closest to a particular target point x0∈X. In the classic simple linear regression we have the following model: yi=f(xi)+ϵi where f(xi) is: f(xi)=β0+β1⋅xi and in the case of loess with approximate f(xi) by a polynomial weigthed by a function wi that assigns higher weights to points xi that are closer to x0: f(xi)=wi(x0)⋅[β0+β1⋅xi+β2⋅x2i+…] Procedure: Let xi denote a set of n values for a particular variable and let yi represent the corresponding response variable. Find the k closest points to the target point x0. Read more