def test_prob_item_given_tag(self):
        self.__init_test(test.SMALL_DEL_FILE)
        
        lambda_ = 0.3
        smooth_func = 'Bayes'
        p = SmoothEstimator(smooth_func, lambda_, self.annots, 1)
        
        for tag in [0, 1, 2, 3, 4, 5]:
            pis = []
            pits = []
            
            for item in [0, 1, 2, 3, 4]:
                pi = p.prob_item(item)
                pti = p.prob_tag_given_item(item, tag)
                
                pis.append(pi)
                pits.append(pti * pi)
                
            #Assert
            pis = np.array(pis)
            pis /= pis.sum()
            
            pits = np.array(pits)
            pits /= pits.sum()
            
            gamma_items = np.array([0, 1, 2, 3, 4])
            assert_array_almost_equal(pis, p.prob_items(gamma_items))
            assert_array_almost_equal(pits, p.prob_items_given_tag(tag, 
                                                                gamma_items))

            self.assertAlmostEqual(1, sum(p.prob_items(gamma_items)))
            self.assertAlmostEqual(1, 
                    sum(p.prob_items_given_tag(tag, gamma_items)))             
    def test_prob_item_given_tag(self):
        self.__init_test(test.SMALL_DEL_FILE)

        lambda_ = 0.3
        smooth_func = 'Bayes'
        p = SmoothEstimator(smooth_func, lambda_, self.annots, 1)

        for tag in [0, 1, 2, 3, 4, 5]:
            pis = []
            pits = []

            for item in [0, 1, 2, 3, 4]:
                pi = p.prob_item(item)
                pti = p.prob_tag_given_item(item, tag)

                pis.append(pi)
                pits.append(pti * pi)

            #Assert
            pis = np.array(pis)
            pis /= pis.sum()

            pits = np.array(pits)
            pits /= pits.sum()

            gamma_items = np.array([0, 1, 2, 3, 4])
            assert_array_almost_equal(pis, p.prob_items(gamma_items))
            assert_array_almost_equal(pits,
                                      p.prob_items_given_tag(tag, gamma_items))

            self.assertAlmostEqual(1, sum(p.prob_items(gamma_items)))
            self.assertAlmostEqual(
                1, sum(p.prob_items_given_tag(tag, gamma_items)))