This commit is contained in:
snsd0805 2023-10-26 23:21:25 +08:00
parent d50a247499
commit 1c6f295d85
Signed by: snsd0805
GPG Key ID: 569349933C77A854

View File

@ -14,7 +14,7 @@ def decision_stump(x, y):
best_Ein = 1e9 best_Ein = 1e9
theta_ans = np.random.uniform(-1, 1, 1)[0] 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])) h_of_x = sign_ans * np.sign(x-np.array([theta_ans]*x.shape[0]))
Ein = (h_of_x != y).sum() Ein = (h_of_x != y).sum()