コード例 #1
0
ファイル: test.py プロジェクト: kolboch/Python-adventure
 def test_prediction(self):
     x = TEST_DATA['pred']['x']
     w = TEST_DATA['pred']['w']
     theta = TEST_DATA['pred']['theta']
     y = TEST_DATA['pred']['y']
     y_computed = prediction(x, w, theta)
     max_diff = np.max(np.abs(y - y_computed))
     self.assertAlmostEqual(max_diff, 0, 6)
コード例 #2
0
    def test_prediction(self):
        x = TEST_DATA['pred']['x']
        w = TEST_DATA['pred']['w']
        theta = TEST_DATA['pred']['theta']
        y_expected = TEST_DATA['pred']['y']

        y = prediction(x, w, theta)

        self.assertEqual(np.shape(y), (50, 1))
        np.testing.assert_almost_equal(y, y_expected)
コード例 #3
0
def face_detect_patch(patch, w, theta):
    patch = patch / 255.0
    hog_patch = hog(patch)
    return prediction(np.transpose(np.concatenate(([[1]], hog_patch))), w,
                      theta)