From 1c6f295d853d2a56ec5244ae4b3aa1678abc389e Mon Sep 17 00:00:00 2001 From: snsd0805 Date: Thu, 26 Oct 2023 23:21:25 +0800 Subject: [PATCH] fix: hw2 --- hw2/hw2_12.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw2/hw2_12.py b/hw2/hw2_12.py index 75cc8bc..de80c61 100644 --- a/hw2/hw2_12.py +++ b/hw2/hw2_12.py @@ -14,7 +14,7 @@ def decision_stump(x, y): best_Ein = 1e9 theta_ans = np.random.uniform(-1, 1, 1)[0] - sign_ans = ( np.random.uniform(-1, 1, 1)[0] > 0 ) + sign_ans = 1 if ( np.random.uniform(-1, 1, 1)[0] > 0 ) else -1 h_of_x = sign_ans * np.sign(x-np.array([theta_ans]*x.shape[0])) Ein = (h_of_x != y).sum()