Skip to content

Commit

Permalink
chore(pre-commit.ci): auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Apr 15, 2024
1 parent bfb8335 commit 1eaec74
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/boost_loss/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def eval_metric_lgb(
self,
y_true: NDArray | lgb.Dataset | xgb.DMatrix,
y_pred: NDArray | lgb.Dataset | xgb.DMatrix,
sample_weight: NDArray | lgb.Dataset | xgb.DMatrix | None = None
sample_weight: NDArray | lgb.Dataset | xgb.DMatrix | None = None,
# not used, exists for eval_metric_xgb_sklearn
) -> tuple[str, float, bool]:
"""LightGBM-compatible interface"""
Expand Down
4 changes: 1 addition & 3 deletions src/boost_loss/regression/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ def grad(self, y_true: NDArray, y_pred: NDArray) -> NDArray:
return -y_true / (1 + np.exp(y_true * y_pred))

def hess(self, y_true: NDArray, y_pred: NDArray) -> NDArray:
return (
y_true**2 * np.exp(y_true * y_pred) / (1 + np.exp(y_true * y_pred)) ** 2
)
return y_true**2 * np.exp(y_true * y_pred) / (1 + np.exp(y_true * y_pred)) ** 2

Check warning on line 207 in src/boost_loss/regression/regression.py

View check run for this annotation

Codecov / codecov/patch

src/boost_loss/regression/regression.py#L207

Added line #L207 was not covered by tests


class MSLELoss(LossBase):
Expand Down
31 changes: 18 additions & 13 deletions src/boost_loss/regression/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,32 +217,37 @@ def predict_raw(self, X: Any, **predict_params: Any) -> NDArray[Any]:
def predict(
self,
X: Any,
type_: Literal["mean", "median", "var", "std", "range", "mae", "mse"]
| None = None,
type_: (
Literal["mean", "median", "var", "std", "range", "mae", "mse"] | None
) = None,
return_std: Literal[False] = False,
**predict_params: Any,
) -> NDArray[Any]:
...
) -> NDArray[Any]: ...

@overload
def predict(
self,
X: Any,
type_: tuple[
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
]
| None = None,
type_: (
tuple[
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
]
| None
) = None,
return_std: Literal[True] = ...,
**predict_params: Any,
) -> tuple[NDArray[Any], NDArray[Any]]:
...
) -> tuple[NDArray[Any], NDArray[Any]]: ...

def predict(
self,
X: Any,
type_: Literal["mean", "median", "var", "std", "range", "mae", "mse"]
| tuple[Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]]
| None = None,
type_: (
Literal["mean", "median", "var", "std", "range", "mae", "mse"]
| tuple[
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
]
| None
) = None,
return_std: bool = False,
**predict_params: Any,
) -> NDArray[Any] | tuple[NDArray[Any], NDArray[Any]]:
Expand Down
6 changes: 2 additions & 4 deletions src/boost_loss/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def apply_custom_loss(
target_transformer: None = ...,
recursive: bool = ...,
recursive_strict: bool = ...,
) -> TEstimator:
...
) -> TEstimator: ...


@overload
Expand All @@ -46,8 +45,7 @@ def apply_custom_loss(
target_transformer: BaseEstimator = ...,
recursive: bool = ...,
recursive_strict: bool = ...,
) -> TransformedTargetRegressor:
...
) -> TransformedTargetRegressor: ...


def apply_custom_loss(
Expand Down

0 comments on commit 1eaec74

Please sign in to comment.