def runTestWithSeed(self, seed):
    with self.cached_session():
      distances = np.zeros(1000).astype(np.float32)
      distances[6] = 10e7
      distances[4] = 10e3

      sampled_point = clustering_ops.kmc2_chain_initialization(distances, seed)
      self.assertAllEqual(sampled_point, 6)
      distances[6] = 0.0
      sampled_point = clustering_ops.kmc2_chain_initialization(distances, seed)
      self.assertAllEqual(sampled_point, 4)
Exemplo n.º 2
0
    def runTestWithSeed(self, seed):
        with self.cached_session():
            distances = np.zeros(1000).astype(np.float32)
            distances[6] = 10e7
            distances[4] = 10e3

            sampled_point = clustering_ops.kmc2_chain_initialization(
                distances, seed)
            self.assertAllEqual(sampled_point, 6)
            distances[6] = 0.0
            sampled_point = clustering_ops.kmc2_chain_initialization(
                distances, seed)
            self.assertAllEqual(sampled_point, 4)
 def testBasic(self):
   with self.cached_session():
     counts = {}
     seed = 0
     for i in range(50):
       sample = self.evaluate(
           clustering_ops.kmc2_chain_initialization(self._distances, seed + i))
       counts[sample] = counts.get(sample, 0) + 1
     self.assertEquals(len(counts), 2)
     self.assertTrue(500 in counts)
     self.assertTrue(1000 in counts)
     self.assertGreaterEqual(counts[500], 5)
     self.assertGreaterEqual(counts[1000], 5)
Exemplo n.º 4
0
 def testBasic(self):
     with self.cached_session():
         counts = {}
         seed = 0
         for i in range(50):
             sample = self.evaluate(
                 clustering_ops.kmc2_chain_initialization(
                     self._distances, seed + i))
             counts[sample] = counts.get(sample, 0) + 1
         self.assertEqual(len(counts), 2)
         self.assertTrue(500 in counts)
         self.assertTrue(1000 in counts)
         self.assertGreaterEqual(counts[500], 5)
         self.assertGreaterEqual(counts[1000], 5)
Exemplo n.º 5
0
 def runTestWithSeed(self, seed):
     with self.cached_session():
         sampled_point = clustering_ops.kmc2_chain_initialization(
             self._distances, seed)
         self.assertAllEqual(sampled_point, 0)
 def runTestWithSeed(self, seed):
   with self.cached_session():
     sampled_point = clustering_ops.kmc2_chain_initialization(
         self._distances, seed)
     self.assertAllEqual(sampled_point, 0)