示例#1
0
 def test_dame_sexmachine_guess_list_method_returns_correct_result(self):
     ds = DameSexmachine()
     self.assertEqual(['male', 'male', 'male', 'male', 'female', 'male', 'female', 'female', 'male', 'male', 'male', 'male', 'male', 'male', 'female', 'male', 'male', 'male', 'female', 'male', 'male'], ds.guess_list(path="files/names/partial.csv", binary=False))
     self.assertEqual([1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], ds.guess_list(path="files/names/partial.csv",binary=True))
     self.assertEqual([1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], ds.guess_list(path="files/names/partial.csv",binary=True, ml="nltk"))
     # sgd_model = ds.sgd_load()
     # self.assertEqual([0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0], ds.guess_list(path="files/names/partial.csv",binary=True, ml="sgd"))
     svc_model = ds.svc_load()
     self.assertEqual([1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1], ds.guess_list(path="files/names/partial.csv",binary=True, ml="svc"))
 def test_sexmachine_svc_load(self):
     s = DameSexmachine()
     m = s.svc_load()
     predicted = m.predict([[
         0, 0, 1, 0, 21, 0, 0, 0, 0, 34, 2, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0,
         0, 0, 0, 2, 0, 0, 0, 34, 1, 0, 1
     ]])
     n = np.array([1])
     self.assertTrue(np.array_equal(predicted, n))
 def test_dame_sexmachine_guess_list(self):
     ds = DameSexmachine()
     self.assertEqual([
         'male', 'male', 'male', 'male', 'male', 'male', 'female', 'female',
         'male', 'male', 'male', 'male', 'male', 'male', 'male', 'male',
         'male', 'male', 'female', 'male', 'male'
     ], ds.guess_list(path="files/names/partial.csv", binary=False))
     self.assertEqual(
         [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1],
         ds.guess_list(path="files/names/partial.csv", binary=True))
     self.assertEqual(
         [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1],
         ds.guess_list(path="files/names/partial.csv",
                       binary=True,
                       ml="nltk"))
     svc_model = ds.svc_load()
     self.assertEqual(
         [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1],
         ds.guess_list(path="files/names/partial.csv",
                       binary=True,
                       ml="svc"))
示例#4
0
 def test_sexmachine_svc_load_method_returns_correct_result(self):
     s = DameSexmachine()
     m = s.svc_load()
     predicted = m.predict([[ 0,  0,  1,  0, 21,  0,  0,  0,  0, 34,  2,  0,  0,  0,  0,  0, 0,  0,  0,  5,  0,  0,  0,  0,  0,  2,  0,  0,  0, 34,  1,  0, 1, 0]])
     n = np.array([1])
     self.assertTrue(np.array_equal(predicted, n))