Home
News
Feed
search engine
by
freefind
advanced
How to rearrange a list of instances from their original positions to their clustered positions
2015-01-13
azim58 - How to rearrange a list of instances from their original positions to their clustered positions How to rearrange a list of instances from their original positions to their clustered positions One way to do this is to add a number to the name of each instance to keep track of what position everything originally was in. Then cluster with weka. Then make a new list that has all the new positions of the original positions. Then I can use a program to make a list of numbers that can help me reorder the original list by sorting them into excel. So let's say the original order of elements is 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28, 29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50 Then I cluster the instances with a program like weka and the new order is 2,4,8,9,10,12,15,21,17,18,19,20,25,23,26,28,29,33,34,35,38,27,30,43,31,32,3 6,37,41,44,48,47,46,45,50,42,49,13,14,39,40,3,5,6,11,16,22,24,7,1 Note that not all of the original elements may be in the output from Weka so you may have to manually add these. Now I want to generate a new list that will let me sort the instances in excel so that they are in the appropriate order. For example above, we see that the new list should sort the elements so that the 2nd element of the original list is moved to the first position, the 4th element is moved to the 2nd position, etc. So the new list would look something like some_number,1,some_number,some_number,2, . . . Here's the list after it was reordered with a program. 50, 1, 42, 2, 43, 44, 49, 3, 4, 5, 45, 6, 38, 39, 7, 46, 9, 10, 11, 12, 8, 47, 14, 48, 13, 15, 22, 16, 17, 23, 25, 26, 18, 19, 20, 27, 28, 21, 40, 41, 29, 36, 24, 30, 34, 33, 32, 31, 37, 35 Some Java code to do this can be found here L:\storage\CIM Research Folder\DR\2012\5-9-12\program to reorder
azim58wiki: