Results 1 to 7 of 7
- 04-05-2011, 12:56 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 46
- Rep Power
- 0
how can I compare HashMaps with different keys ?
I have a clustering algorithm storing the clusters in HashMap<String, ArrayList<String>>.
I need to compare it with the ground truth which is stored in another HashMap<String, ArrayList<String>>.
The keys are not the same, because the array is created by incremental clustering, so I was wondering how can I compare the original clusters with the generated ones.
I'm using NMI and BCUBED as clustering evaluation measures, but my problem is how to refer to the same cluster (ArrayList<String>) if they have different keys..
any idea ?
thanks
- 04-05-2011, 01:39 PM #2
Erm, I suppose you could get all of the values in each map and compare them?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-05-2011, 02:01 PM #3
Member
- Join Date
- Aug 2008
- Posts
- 46
- Rep Power
- 0
Yeah but how do I compare the respective clusters ? You know what I mean ? How can I find the correct cluster and compare to the original one ?
- 04-05-2011, 02:34 PM #4
That's not really a question we can answer. We don't know any of the specifics you're working with. Is there a way to convert from one key to another? Are you just trying to compare for equality (as in, does on Map contain a certain value found in another Map)? Something else?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-05-2011, 02:49 PM #5
Member
- Join Date
- Aug 2008
- Posts
- 46
- Rep Power
- 0
Yeah I'm comparing if each item in the map has the same content of the original map. My issue is that the items are not necessarily in the same order...
- 04-05-2011, 03:02 PM #6
So where exactly are you getting stuck? Do you know how to get the values of a Map? Do you know how to iterate over them? Do you know how to compare two collections?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-05-2011, 03:12 PM #7
Member
- Join Date
- Aug 2008
- Posts
- 46
- Rep Power
- 0
I know how to get values of the map, I know how to iterate them. I don't know how to recognize the same cluster (HashMap value, that is an ArrayList<String>) since the keys are different between original HashMap and new generated HashMap.
I need to compare the clusters to see how much they differ. I have a similarity measure for that, but I dunno how to compare them.
In otherwords I need to compare the Hashmaps, which have the elements not in the same order, and with different keys.
Similar Threads
-
Concerning HashMaps
By hjensen in forum New To JavaReplies: 7Last Post: 10-18-2010, 03:36 PM -
Add keys to arraylist
By PhQ in forum New To JavaReplies: 29Last Post: 07-20-2010, 01:37 PM -
Problems with HashMaps
By li_bi in forum New To JavaReplies: 13Last Post: 02-24-2010, 12:08 PM -
HashMaps get key for a specific value
By andre1011 in forum Advanced JavaReplies: 2Last Post: 03-11-2009, 02:30 AM -
Media Keys
By tikigod in forum New To JavaReplies: 0Last Post: 01-28-2009, 11:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks