I have a linked list, containing objects with a linked list object inside. I have to find the min/max values in the "table's" each "column". Those values then are stored in a MinMax object and added to a linked list. I have a hunch that this piece of code is not finding the values correctly. Maybe there is a better way?
Thanks in advance!
Janis Strautins wrote:Yes I have, it's a global variable.
OK, why don't you show us ALL the relevant code (but only the bits that relate to THIS function). It's a bit difficult to make an assessment without all the information.
However, just off the top of my head, I don't like the sound of a "global variable". max() is a function, not a value.
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here
Joined: Dec 12, 2012
Ok, I tried to find all the code. The KMeans class gets the table when it is created. After that, MinMax() is called, which finds the min/max value in each column. A call to CreateCentroids, which uses the intervalList to generate numbers in the interval. When i print the values from the centroid creation, the min value is 0, although there is no such value in the table. I'm thinking of just creating two linked lists, one for the min and one for the max values. This seemed such an easy task, but as usual, the easier it seems, the harder it is..
Janis Strautins wrote:Ok, I tried to find all the code.
That's not really what I asked for. I said all relevant code; but never mind...
It sounds to me like you're dealing with far too much. Forget your matrix for the moment, and just try to write a method that returns the minimum or maximum value from a simple List (or array). You can always refine it later on to deal with "columns".
And before you write another line of Java code, sit down with a pencil and paper and write out the solution in English.
Janis Strautins wrote:Thanks for the advice But i prefer to write down the solution in my native tongue.
Anyway, used 2 lists for the values and everything is working like a charm, thanks for the help^^
Dutch? Or Swede?
Joined: Dec 12, 2012
You guessed wrong, Latvian
While this topic is still alive, i have a question regarding hierarchical clustering - after the algorithm has completed, how should i find the center of each of the clusters? In k-means it's easy, because i have the centers from the very beginning, but in the case divisive and agglomerative algorithms, i don't. That is neede so i can calculate the average/sum distance to the center of the cluster. Any ideas?