Ejemplo n.º 1
0
 def test_exponential_cascade_with_no_click(self):
     choice_features = {'attention_prob': 1.0, 'score_scaling': 0.0}
     model = choice_model.ExponentialCascadeChoiceModel(choice_features)
     model.score_documents(self._user_state, np.array([[3.0], [2.0],
                                                       [1.0]]))
     self.assertEqual(model.choose_item(), None)
Ejemplo n.º 2
0
 def test_exponential_cascade_invalid_attenion_prob(self):
     with self.assertRaises(ValueError):
         choice_features = {'attention_prob': 2.0}
         choice_model.ExponentialCascadeChoiceModel(choice_features)
Ejemplo n.º 3
0
 def test_exponential_cascade(self):
     choice_features = {'score_scaling': 0.04}
     model = choice_model.ExponentialCascadeChoiceModel(choice_features)
     model.score_documents(self._user_state, np.array([[3.0], [2.0],
                                                       [1.0]]))
     self.assertEqual(model.choose_item(), 0)
Ejemplo n.º 4
0
 def test_exponential_cascade_invalid_score_scaling(self):
     with self.assertRaises(ValueError):
         choice_features = {'attention_prob': 0.8, 'score_scaling': -1.0}
         choice_model.ExponentialCascadeChoiceModel(choice_features)