\input{figures/pseudo-code/lwl.tex}
Locally Weighted Learning\cite{LWL}, or LWL, is a lazy Naive Bayes classifier. It
is called lazy because, upon training, the data is just stored,
leaving the computational work to occur during testing. Testing is
accomplished one row at a time. 

As each row is tested, the records in
the training set are weighted based on their Euclidean distance from
the testing row. A value of $K$ is given to the classifier, and this acts as an upper bounds to how many training instances will be used during classification. The $K^{th}$ nearest training instances are used, each weighted by their distance from the test instance. Any training instance further away than the $K^{th}$ nearest instance receives a weight of zero. After the training instances are weighted, a standard
Naive Bayes algorithm is applied.

This algorithm assumes that the data near the testing row holds the
most relevance to it. It is possible that two rows can be near
each other while never sharing a common attribute. It is also possible
that two rows could be identical in several attributes, while having
many that are substantially different. This can cause similar instances to be overlooked because of a small number of significantly different variables.
