Skip to content

Commit

Permalink
[Hotfix] fix isinstance type and add max in clip (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
RektPunk authored Sep 25, 2024
1 parent f5d01bd commit 91fefdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion imlightgbm/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def predict(
raw_score
or pred_leaf
or pred_contrib
or isinstance(_predict, spmatrix | list[spmatrix])
or isinstance(_predict, spmatrix | list)
):
return _predict

Expand Down
2 changes: 1 addition & 1 deletion imlightgbm/objective/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def _safe_power(num_base: np.ndarray, num_pow: float):

def _safe_log(array: np.ndarray, min_value: float = 1e-6) -> np.ndarray:
"""Safe log."""
return np.log(np.clip(array, min_value))
return np.log(np.clip(array, min_value, None))


def sklearn_binary_focal_objective(
Expand Down

0 comments on commit 91fefdb

Please sign in to comment.