Page 145 - Data Science Algorithms in a Week
P. 145

Clustering into K Clusters


                       th
                                                                           th
                                                  th
            Now the 15  couple is in the cluster 1, 16  couple in the cluster 2, 17  couple in the cluster 2.
            So the estimated number of the children for each couple is 5/4=1.25.
            The error E3 of the estimation is:
                                   2
                                           2
                           2
            E3=sqrt((1.25-1) +(1.25-0) +(1.25-3) )~2.17
            Output for 4 clusters:
                Cluster 0: [(1, (48.0, 49.0)), (4, (49.0, 42.0)), (10, (42.0, 47.0)), (12,
                (41.0, 45.0))]
                Cluster 1: [(3, (24.0, 28.0)), (6, (24.0, 27.0)), (11, (22.0, 27.0))]
                Cluster 2: [(2, (40.0, 43.0)), (13, (39.0, 43.0)), (14, (36.0, 38.0)), (16,
                (36.0, 38.0)), (17, (36.0, 39.0)), (18, (37.0, 38.0))]
                Cluster 3: [(5, (32.0, 34.0)), (7, (29.0, 32.0)), (8, (35.0, 35.0)), (9,
                (33.0, 36.0)), (15, (30.0, 32.0))]
                  th
                                              th
                                                                th
            The 15  couple is in the cluster 3, 16  in the cluster 2, 17  in the cluster 2. So the estimated
            number of the children for the 15  couple is 5/4=1.25. The estimated number of the children
                                           th
                             th
            for the 16  and 17  couple is 8/3~2.67 children.
                     th
            The error E4 of the estimation is:
                           2
                                          2
            E4=sqrt((1.25-1) +(8/3-0) +(8/3-3) )~2.70
                                  2
            Output for 5 clusters:
                Cluster 0: [(1, (48.0, 49.0)), (4, (49.0, 42.0))]
                Cluster 1: [(3, (24.0, 28.0)), (6, (24.0, 27.0)), (11, (22.0, 27.0))]
                Cluster 2: [(8, (35.0, 35.0)), (9, (33.0, 36.0)), (14, (36.0, 38.0)), (16,
                (36.0, 38.0)), (17, (36.0, 39.0)), (18, (37.0, 38.0))]
                Cluster 3: [(5, (32.0, 34.0)), (7, (29.0, 32.0)), (15, (30.0, 32.0))]
                Cluster 4: [(2, (40.0, 43.0)), (10, (42.0, 47.0)), (12, (41.0, 45.0)), (13,
                (39.0, 43.0))]

            The 15  couple is in the cluster 3, 16  in the cluster 2, 17  in the cluster 2. So the estimated
                                              th
                                                                th
                  th
                                           th
            number of the children for the 15  couple is 1. The estimated number of the children for the
            16  and 17  couple is 5/3~1.67.
              th
                      th
            The error E5 of the estimation is:
                                       2
                                2
                        2
            E5=sqrt((1-1) +(5/3-0) +(5/3-3) )~2.13




                                                    [ 133 ]
   140   141   142   143   144   145   146   147   148   149   150