Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-547

KMeansPlusPlusClusterer should not call equals()

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Labels:
      None

      Description

      In determining whether the clusters have changed between iterations, the KMeansPlusPlusClusterer currently calls equals to determine whether the cluster centers have changed. It would be better to avoid relying on equals by instead checking whether any points have moved between clusters.

      equals can be problematic because floating point operations are not strictly commutative or associative, so getCentroid may return slightly different values even when called with the same set of inputs. Additionally, the client may choose not to override equals at all, since it's not clear that it's required.

        Attachments

        1. MATH-547.patch
          5 kB
          Thomas Neidhart

          Activity

            People

            • Assignee:
              luc Luc Maisonobe
              Reporter:
              npaymer Nate Paymer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: