[
https://issues.apache.org/jira/browse/MAHOUT-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17217574#comment-17217574
]
Trevor Grant commented on MAHOUT-1959:
--------------------------------------
[~haozhong] we changed our default branch and all issues were closed- if you
would still like to submit this- please reopen again the `trunk` branch, and
thanks!
> BallKMeans.iterativeAssignment can set wrong weights.
> -----------------------------------------------------
>
> Key: MAHOUT-1959
> URL: https://issues.apache.org/jira/browse/MAHOUT-1959
> Project: Mahout
> Issue Type: Bug
> Reporter: Hao Zhong
> Priority: Major
>
> I notice that the BallKMeans.iterativeAssignment method uses the following
> code to calculate weights:
> {code:title=BallKMeans.java|borderStyle=solid}
> for (WeightedVector datapoint : datapoints) {
> Centroid closestCentroid = (Centroid)
> centroids.searchFirst(datapoint, false).getValue();
> closestCentroid.setWeight(closestCentroid.getWeight() +
> datapoint.getWeight());
> }
> {code}
> In MAHOUT-1237, the buggy code is the same way to calculate the weight:
> {code:title=ClusteringUtils.java|borderStyle=solid}
> for (Vector vector : datapoints) {
> Centroid closest = (Centroid) centroids.searchFirst(vector,
> false).getValue();
> totalCost += closest.getWeight();
> }
> {code}
> The fixed code is as follow:
> {code:title=ClusteringUtils.java|borderStyle=solid}
> for (Vector vector : datapoints) {
> totalCost += centroids.searchFirst(vector, false).getWeight();
> }
> {code}
> I am not quite sure whether BallKMeans.iterativeAssignment sets the right
> weights. Please check it.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)