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

KMeansPlusPlusClusterer Exception when clusters>variables

    Details

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

      Description

      It would be nice when KMeansPlusPlusClusterer generates an exception when the number of cluster is larger than the number of variables.

      KMeansPlusPlusClustererTest:
      /**

      • 2 variables cannot be clustered into 3 clusters.
        */
        @Test
        public void testPerformClusterAnalysisToManyClusters() {
        KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
        new Random(1746432956321l));
        EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[]
        Unknown macro: { new EuclideanIntegerPoint(new int[] { 1959, 325100 }), new EuclideanIntegerPoint(new int[] { 1960, 373200 }), }

        ;
        try

        { transformer.cluster(Arrays.asList(points), 3, 1); Assert.fail(); }

        catch (Exception e)

        { // 2 variables cannot be clustered into 3 clusters. }

        }

        Attachments

        1. MATH-436.patch
          4 kB
          Thomas Neidhart

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              erikvaningen Erik van Ingen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.25h
                0.25h
                Remaining:
                Remaining Estimate - 0.25h
                0.25h
                Logged:
                Time Spent - Not Specified
                Not Specified