Skip to content

Commit

Permalink
FIX boosting: apply mindelta properly
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Feb 9, 2017
1 parent cdfac7e commit 1e99ad9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 4 additions & 5 deletions eelbrain/_trf/_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,13 @@ def boost_segs(y_train, y_test, x_train, x_test, trf_length, delta, mindelta,

# If no improvements can be found reduce delta
if new_train_error > e_train:
if delta < mindelta:
delta *= 0.5
if delta >= mindelta:
continue
else:
reason = ("No improvement possible for training data, "
"stopping...")
break
else:
delta *= 0.5
# print("No improvement, new delta=%s..." % delta)
continue

# update h with best movement
h[i_stim, i_time] += delta_signed
Expand Down
5 changes: 3 additions & 2 deletions eelbrain/_trf/tests/test_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def run_boosting(ds, mp):
x2_mean = x2.mean()

# test values from running function, not verified independently
res = boosting(y, x1 * 2000, 0, 1, scale_data=False)
eq_(repr(res), '<boosting y ~ x1, 0 - 1, scale_data=False>')
res = boosting(y, x1 * 2000, 0, 1, scale_data=False, mindelta=0.0025)
eq_(repr(res),
'<boosting y ~ x1, 0 - 1, scale_data=False, mindelta=0.0025>')
eq_(round(res.r, 2), 0.75)
assert_is_none(res.y_mean)

Expand Down

0 comments on commit 1e99ad9

Please sign in to comment.