def testDefineGroupsOnlyOneSampleK3(self):
     claseA = [(1.0, 1.0)]
     claseB = [(0.0, 0.0), (2.0, 2.0)]
     k = 3
     d = 2
     
     clusterContainerA, model = prepare(claseA, claseB, k, d)
     self.assertEquals([((1.0, 1.0),)], Grouper.defineGroups(clusterContainerA, model, k))
    def testDefineGroupsOnlyOneGroupK33D(self):
        claseA = [(1.0, 1.0, 0.0), (2.0, 1.0, 0.0), (3.0, 1.0, 0.0)]
        claseB = [(0.0, 1.0, 0.0), (4.0, 1.0, 0.0)]
        k = 3
        d = 3
        
        clusterContainerA, model = prepare(claseA, claseB, k, d)

        self.assertEquals([((3.0, 1.0, 0.0), (1.0, 1.0, 0.0), (2.0, 1.0, 0.0))], Grouper.defineGroups(clusterContainerA, model, k))
        pass
    def testdefineGroups4D(self):
        
        claseA = [(0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 2.0, 0.0), (0.0, 0.0, 3.0, 0.0), (0.0, 0.0, 4.0, 0.0), (0.0, 0.0, 5.0, 0.0), (0.0, 0.0, 6.0, 0.0), (0.0, 0.0, 7.0, 0.0), (0.0, 0.0, 8.0, 0.0), (0.0, 0.0, 9.0, 0.0), (0.0, 0.0, 10.0, 0.0), (0.0, 0.0, 11.0, 0.0)]
        claseB = [(0.0, 0.0, 2.5, 0.0), (0.0, 0.0, 5.5, 0.0), (0.0, 0.0, 9.5, 0.0)]
        k = 4
        d = 4
        
        writeSample(claseA, "model/class1.dat")
        writeSample(claseB, "model/class0.dat")
        
        clusterContainerA, model = prepare(claseA, claseB, k, d)
        
        self.assertEquals(set([((0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 2.0, 0.0)), ((0.0, 0.0, 5.0, 0.0), (0.0, 0.0, 3.0, 0.0), (0.0, 0.0, 4.0, 0.0)), ((0.0, 0.0, 10.0, 0.0), (0.0, 0.0, 11.0, 0.0)), ((0.0, 0.0, 6.0, 0.0), (0.0, 0.0, 7.0, 0.0), (0.0, 0.0, 8.0, 0.0), (0.0, 0.0, 9.0, 0.0))]), set(Grouper.defineGroups(clusterContainerA, model, k)))

        pass
 def testdefineGroups3D(self):
     
     claseA = [(0.0, 0.0, 1.0), (0.0, 0.0, 2.0), (0.0, 0.0, 3.0), (0.0, 0.0, 4.0), (0.0, 0.0, 5.0), (0.0, 0.0, 6.0), (0.0, 0.0, 7.0), (0.0, 0.0, 8.0), (0.0, 0.0, 9.0), (0.0, 0.0, 10.0)]
     claseB = [(0.0, 0.0, 2.5), (0.0, 0.0, 5.5), (0.0, 0.0, 9.5)]
     k = 4
     d = 3
     
     clusterContainerA, model = prepare(claseA, claseB, k, d)
     
     self.assertEquals(set([((0.0, 0.0, 1.0), (0.0, 0.0, 2.0)), ((0.0, 0.0, 5.0), (0.0, 0.0, 3.0), (0.0, 0.0, 4.0)), ((0.0, 0.0, 10.0),), ((0.0, 0.0, 6.0), (0.0, 0.0, 7.0), (0.0, 0.0, 8.0), (0.0, 0.0, 9.0))]), set(Grouper.defineGroups(clusterContainerA, model, k)))
     pass
 def testDefineGroupsOneGroupForeachSample4D(self):
     claseA = [(0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 2.0, 0.0), (0.0, 2.0, 0.0, 0.0), (0.0, 2.0, 2.0, 0.0)]
     claseB = [(0.0, 0.0, 0.1, 0.0), (0.0, 1.0, 2.0, 0.0), (0.0, 2.0, 1.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 1.0, 1.0, 0.0)]
     k = 4
     d = 4
     
     clusterContainerA, model = prepare(claseA, claseB, k, d)
     self.assertEquals([((0.0, 0.0, 0.0, 0.0),), ((0.0, 2.0, 0.0, 0.0),), ((0.0, 2.0, 2.0, 0.0),), ((0.0, 0.0, 2.0, 0.0),)], Grouper.defineGroups(clusterContainerA, model, k))
    def testDefineGroupsOnlyOneGroupK24D(self):
        claseA = [(0.0, 1.0, 1.0, 0.0), (0.0, 2.0, 1.0, 0.0), (0.0, 3.0, 1.0, 0.0)]
        claseB = [(0.0, 0.0, 1.0, 0.0), (0.0, 4.0, 1.0, 0.0)]
        k = 2
        d = 4
        
        clusterContainerA, model = prepare(claseA, claseB, k, d)

        self.assertEquals([((0.0, 3.0, 1.0, 0.0), (0.0, 1.0, 1.0, 0.0), (0.0, 2.0, 1.0, 0.0))], Grouper.defineGroups(clusterContainerA, model, k))
        pass