Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Average Linkage is computed wrongly #1

Open
GoogleCodeExporter opened this issue Dec 22, 2015 · 2 comments
Open

Average Linkage is computed wrongly #1

GoogleCodeExporter opened this issue Dec 22, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

cSize[c1] += cSize[c2];
...
else if (linkage == figue.AVERAGE_LINKAGE) {
var avg = ( cSize[c1] * distMatrix[c1][j] + cSize[c2] *        
distMatrix[c2][j])  / (cSize[c1] + cSize[j]) 
distMatrix[j][c1] = distMatrix[c1][j] = avg;

should be:

var avg = ( cSize[c1] * cSize[j] * distMatrix[c1][j] + cSize[c2] * cSize[j] * 
distMatrix[c2][j])  / ( (cSize[c1] + cSize[c2]) * cSize[j] ) 
distMatrix[j][c1] = distMatrix[c1][j] = avg;
....
cSize[c1] += cSize[c2]; // update cluster size later




Original issue reported on code.google.com by netge...@gmail.com on 16 Oct 2012 at 11:12

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Or eliminating the cSize[j] term we can write:

var avg = (cSize[c1] * distMatrix[c1][j] + cSize[c2] * distMatrix[c2][j])  / 
(cSize[c1] + cSize[c2/*j*/])  
...
cSize[c1] += cSize[c2]; // update cluster size after average linkage 
calculations

Original comment by netge...@gmail.com on 17 Oct 2012 at 10:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant