class TestCorrelation(Test): def __init__(self): super(TestCorrelation, self).__init__() self.pearson = Pearson(self.DATA_PRED) def test_CORR_Pearson_compute_all(self): assert_equal(self.pearson.compute(), 0.930024) def test_CORR_Pearson_load_test(self): pearson = Pearson() pearson.load_test(self.TEST_DATA) assert_equal(len(pearson.get_test()), len(self.TEST_DATA)) def test_CORR_Pearson_load_ground_truth(self): pearson = Pearson() pearson.load_ground_truth(self.GT_DATA) assert_equal(len(pearson.get_ground_truth()), len(self.GT_DATA)) def test_CORR_Pearson_add_entry(self): self.pearson.add(1, 4) #1: Real rating, 4: Predicted rating assert_equal(len(self.pearson.get_test()), len(self.DATA_PRED)+1) assert_equal(len(self.pearson.get_ground_truth()), len(self.DATA_PRED)+1) assert_equal(self.pearson.compute(), 0.498172)
def test_CORR_Pearson_load_ground_truth(self): pearson = Pearson() pearson.load_ground_truth(self.GT_DATA) assert_equal(len(pearson.get_ground_truth()), len(self.GT_DATA))
def test_CORR_Pearson_load_test(self): pearson = Pearson() pearson.load_test(self.TEST_DATA) assert_equal(len(pearson.get_test()), len(self.TEST_DATA))
def __init__(self): super(TestCorrelation, self).__init__() self.pearson = Pearson(self.DATA_PRED)