def testEquals(self):
    a = clusters.bicluster([1, 2, 3])
    b = clusters.bicluster([1, 2, 3])
    self.assertEquals(a, b)
    self.assertFalse(a != b)

    self.assertEquals(clusters.bicluster([], left=a),
                      clusters.bicluster([], left=b))
    self.assertEquals(clusters.bicluster([], right=a),
                      clusters.bicluster([], right=b))
    self.assertEquals(clusters.bicluster([], distance=2.5),
                      clusters.bicluster([], distance=2.5))
    self.assertEquals(clusters.bicluster([], id=5),
                      clusters.bicluster([], id=5))
예제 #2
0
    def testEquals(self):
        a = clusters.bicluster([1, 2, 3])
        b = clusters.bicluster([1, 2, 3])
        self.assertEquals(a, b)
        self.assertFalse(a != b)

        self.assertEquals(clusters.bicluster([], left=a),
                          clusters.bicluster([], left=b))
        self.assertEquals(clusters.bicluster([], right=a),
                          clusters.bicluster([], right=b))
        self.assertEquals(clusters.bicluster([], distance=2.5),
                          clusters.bicluster([], distance=2.5))
        self.assertEquals(clusters.bicluster([], id=5),
                          clusters.bicluster([], id=5))
  def testNormal(self):
    rows = [[6, 4, 2],
            [2, 4, 6],
            [1, 2, 3],
            [3, 2, 1.01]]


    clust = [clusters.bicluster(rows[i], id=i) for i in range(len(rows))]

    c0 = clusters.bicluster(clusters.mergevecs(rows[1], rows[2]),
      left=clust[1], right=clust[2], id=-1, distance=0.0)
    c1 = clusters.bicluster(clusters.mergevecs(rows[0], rows[3]),
      left=clust[0], right=clust[3], id=-2,
      distance=clusters.pearson_dist(rows[0], rows[3]))
    c2 = clusters.bicluster(clusters.mergevecs(c0.vec, c1.vec),
      left=c0, right=c1, id=-3,
      distance=clusters.pearson_dist(c0.vec, c1.vec))

    self.assertEquals(c2, clusters.hcluster(rows))
예제 #4
0
    def testNormal(self):
        rows = [[6, 4, 2], [2, 4, 6], [1, 2, 3], [3, 2, 1.01]]

        clust = [clusters.bicluster(rows[i], id=i) for i in range(len(rows))]

        c0 = clusters.bicluster(clusters.mergevecs(rows[1], rows[2]),
                                left=clust[1],
                                right=clust[2],
                                id=-1,
                                distance=0.0)
        c1 = clusters.bicluster(clusters.mergevecs(rows[0], rows[3]),
                                left=clust[0],
                                right=clust[3],
                                id=-2,
                                distance=clusters.pearson_dist(
                                    rows[0], rows[3]))
        c2 = clusters.bicluster(clusters.mergevecs(c0.vec, c1.vec),
                                left=c0,
                                right=c1,
                                id=-3,
                                distance=clusters.pearson_dist(c0.vec, c1.vec))

        self.assertEquals(c2, clusters.hcluster(rows))