示例#1
0
文件: tests.py 项目: tuxella/pydici
 def test_model(self):
     if not leads_learn.HAVE_SCIKIT:
         return
     r1 = Consultant.objects.get(id=1)
     r2 = Consultant.objects.get(id=2)
     c1 = Client.objects.get(id=1)
     c2 = Client.objects.get(id=1)
     for i in range(20):
         a = create_lead()
         if a.id%2:
             a.state = "WON"
             a.sales = a.id
             a.client= c1
             a.responsible = r1
         else:
             a.state = "FORGIVEN"
             a.sales = a.id
             a.client = c2
             a.responsible = r2
         a.save()
     leads_learn.eval_state_model()
     self.assertGreater(leads_learn.test_state_model(), 0.8, "Proba is too low")
示例#2
0
 def test_state_model(self):
     if not leads_learn.HAVE_SCIKIT:
         return
     r1 = Consultant.objects.get(id=1)
     r2 = Consultant.objects.get(id=2)
     c1 = Client.objects.get(id=1)
     c2 = Client.objects.get(id=1)
     for i in range(20):
         a = create_lead()
         if a.id%2:
             a.state = "WON"
             a.sales = a.id
             a.client= c1
             a.responsible = r1
         else:
             a.state = "FORGIVEN"
             a.sales = a.id
             a.client = c2
             a.responsible = r2
         a.save()
     leads_learn.eval_state_model()
     self.assertGreater(leads_learn.test_state_model(), 0.8, "Proba is too low")