Ejemplo n.º 1
0
 def testPearsonCoefficientValueForTwoVectors(self):
     with self.test_session() as test_session:
         x1 = np.array([2., 3., 4.])
         x2 = np.array([3., 1., 5.])
         actual_pearson_coefficient = test_session.run(pearson_correlation(x1, x2))
         correct_pearson_coefficient = tf.constant([.5])
         self.assertEqual(actual_pearson_coefficient, correct_pearson_coefficient.eval())
Ejemplo n.º 2
0
    def testPositivePearsonCoefficientValueForTwoVectors(self):
        with self.test_session() as test_session:
            x1 = np.array([1., 2., 3.])
            x2 = np.array([1., 2., 3.])

            actual_pearson_coefficient = test_session.run(pearson_correlation(x1, x2))
            correct_pearson_coefficient = [1.]

            self.assertEqual(actual_pearson_coefficient, correct_pearson_coefficient)