Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit f6f34b8

Browse files
author
Ehsan Totoni
committed
fix lr rand test
1 parent e0aa489 commit f6f34b8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

hpat/tests/test_ml.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ def test_impl(N, D):
3232
iterations = 3
3333
g = 2 * np.ones(D) - 1
3434
X = 2 * np.ones((N, D)) - 1
35-
Y = (np.dot(X, g) > 0.0) == (np.ones(N) > .90)
35+
Y = ((np.dot(X, g) > 0.0) == (np.ones(N) > .90))+.0
3636

3737
w = 2 * np.ones(D) - 1
3838
for i in range(iterations):
3939
w -= np.dot(((1.0 / (1.0 + np.exp(-Y * np.dot(X, w))) - 1.0) * Y), X)
40-
#R = np.dot(X,w) > 0.0
41-
#accuracy = np.sum(R == Y) / N
42-
return w
40+
R = np.dot(X, w) > 0.0
41+
accuracy = np.sum(R == Y) / N
42+
return accuracy
4343

4444
hpat_func = hpat.jit(test_impl)
4545
n = 11
4646
d = 4
47-
#np.testing.assert_allclose(hpat_func(n, d), test_impl(n, d))
48-
#self.assertEqual(count_array_OneDs(), 3)
49-
#self.assertEqual(count_parfor_OneDs(), 3)
47+
np.testing.assert_approx_equal(hpat_func(n, d), test_impl(n, d))
48+
self.assertEqual(count_array_OneDs(), 3)
49+
self.assertEqual(count_parfor_OneDs(), 4)
5050

5151
def test_linear_regression(self):
5252
def test_impl(N, D):

0 commit comments

Comments
 (0)