If I have an array that contains the values [6712, 7023, 7510, 7509, 6718, 7514, 7509, 6247] and I want 4 groups of similar numbers so that the output is 4 matrices:
[6247]
[6712, 6718]
[7023]
[7510, 7509, 7514, 7509]
What would be the best way to accomplish this?
I believe the term you are looking for is clustering. For example, we can apply the Kmeans algorithm to group the data into 4 clusters:
This is one of the result I get:
Usually this works best with more points (also works for multidimensional data)