##
Robust cluster analysis

One of the key steps in the method above is the analysis on the
multidimensional scatter of attributes and properties.
This analysis is behind the quality matrix,
provides seismic classification, and is an important step in
calculating the calibration function.
Above, we used K-means cluster analysis which is roughly based on the
following algorithm:

- Arbitrarily divide the points in the scatter to clusters.
Where the number of clusters is a user parameter. For each cluster,
calculate it's center of gravity and the standard deviation which
is the sum of the squares of the distances of each point from
the center of gravity of its cluster.
- Loop over the scatter points. For each point try to move it to another
cluster. Recalculate the standard deviation. If it is reduced accept the
move, if the standard deviation increases reject the move.
- Re-loop until convergence.

This algorithm can be improved.

- Find the reasonable number of cluster instead of requiring the user to
provide it
- Make the analysis more robust by sometimes accepting
a move that increases the objective function to avoid local minima.
- Using L1 or other metrics instead of L2 (squares).