Clustering and Density Estimation
Cluster-Weighted Modeling

This last assignment before the final class project was to implement a fitting function as in Chapter 12 but using cluster-weighted modeling. I took the simplest local model for the clusters, which is a constant. Depending on your input you may need to use many clusters. A better model would at least use a linear function. Also this is a one dimension model, i.e. one input and one output. The power of this algorithm comes with multiple dimensions. Here are some plots for various fonctions.

Here is the Matlab code :