This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Division clustering algorithm

 
Janis Strautins
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I am making the [title] algorithm and I have ran into some problems I can't really understand. It's nothing too complicated, one class reads a file and passes it as a linked list to the main algorithm method(table ->divison). From there, one cluster is created from the start table, the distance matrix is calculated. The highest distance is found and the cluster is split into two. And so on, till some kind of ending, iteration count etc. The algorithm works well for one iteration only, afterwards... I can't see where the possible error is, any help would be greatly appreciated. It's my whole days work, probably can't think straight anymore. Thanks in advance!

One row in the table:



One cell in the matrix:



The cluster class:


Algorithms main running class:


The file reader:

 
Winston Gutkowski
Bartender
Pie
Posts: 9484
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Janis Strautins wrote:I can't see where the possible error is, any help would be greatly appreciated.

Well, I hate to say, but the minute I see anything like:
if(clusterList.get(k).matrix.get(i).distances.get(j).value>max.value) ...
my brain just shuts down.

My suggestion: refactor your code to rationalise all these horrible method chains. You (and we) will be in a much better position to then read your code and understand what it's trying to do.

PS: DontWriteLongLines (←click). I've tried to break yours up as best I can, but you're hamstringing yourself by
(a) Aggressive indentation. (Tip: DON'T use tabs).
(b) The number of layers you're handling at a time.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic