From 6eaee9fff0557c0b03fd01201e6fcab30c814b41 Mon Sep 17 00:00:00 2001 From: RektPunk Date: Wed, 25 Sep 2024 11:14:02 +0900 Subject: [PATCH] hotfix - isinstance type and add max in clip --- imlightgbm/engine.py | 2 +- imlightgbm/objective/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/imlightgbm/engine.py b/imlightgbm/engine.py index b9c57dd..4c5384e 100644 --- a/imlightgbm/engine.py +++ b/imlightgbm/engine.py @@ -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 diff --git a/imlightgbm/objective/core.py b/imlightgbm/objective/core.py index 4ee7cde..5e7fd80 100644 --- a/imlightgbm/objective/core.py +++ b/imlightgbm/objective/core.py @@ -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(