# Cluster Trend Data

I am trying to cluster trend data similar to that created by

data = Table[
RandomReal[{-1, 1}, 20] + 10 offset, {offset, 1, 10, 1}] // Flatten


This data is highly simplified and has a fixed number of values for each cluster. In general this will not be true but the number of possible clusters will be known in advance. The noise level may also vary for each cluster and the average distance between clusters may vary.

Automatic clustering by

ClusteringComponents[data, 10]
ListPlot[%]


is nearly correct but is not stable. In general, I am looking for methods to pre-determine the CritionFunction and DistanceFunction, etc. from the data to stabilize the clustering.

I have previously seen a similar problem discussed here but I cannot locate it via search. Probably just the wrong keywords.

Not sure what you mean by "nearly correct but is not stable". Have you tried FindClusters? e.g.
FindClusters[data, Method -> "DBSCAN"] // ListPlot