Quote:
Originally Posted by Hari Seldon
I recognize some of these words. Certainly there is a kmeans function in R(don't recall the package.)
But what do you mean by network graph?

If you use a normal clustering algorithm, you could group the zipcodes into territories, but there's no way to guarantee that the territories would be contiguous. You would need a dataset that tells you which zipcodes touch other zipcodes which could be represented as a graph:
https://en.wikipedia.org/wiki/Graph_...e_mathematics)
There are packages like iGraph that create clusters within graphs, but the algorithms are usually based on maximizing the number of connections between the nodes, and not on the variance of a weight such as loss cost.
You might be able to dig up some package or code for social networks that does something close enough to what you want. This problem doesn't seem that unique if you think about it.
But if you can't find anything and you aren't comfortable enough customizing your own algorithm, I would just run a regular clustering procedure on the loss costs and zipcode centroids, and hope the results are contiguous enough that you can just handtweak any outliers.