Skip to content

Commit

Permalink
Clip logstd
Browse files Browse the repository at this point in the history
  • Loading branch information
RAMitchell committed Oct 4, 2023
1 parent 444effc commit 86ac069
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion legateboost/objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def transform(self, pred: cn.ndarray) -> cn.ndarray:
# reshape this nicely for the user so mean and variance have their own dimension
pred = pred.reshape((pred.shape[0], pred.shape[1] // 2, 2))
# don't let the variance go to zero
pred[:, :, 1] = cn.maximum(pred[:, :, 1], -5)
pred[:, :, 1] = cn.clip(pred[:, :, 1], -5, 5)
return pred


Expand Down
2 changes: 1 addition & 1 deletion legateboost/test/test_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_normal():
obj = lb.NormalObjective()
y = cn.array([[1.0], [2.0], [3.0]])
init = obj.initialise_prediction(y, cn.array([1.0, 1.0, 1.0]), True)
assert cn.allclose(init, cn.array([y.mean(), y.var()]))
assert cn.allclose(init, cn.array([y.mean(), cn.log(y.std())]))


def test_log_loss():
Expand Down

0 comments on commit 86ac069

Please sign in to comment.