Skip to content

Commit f954494

Browse files
chore(pre-commit.ci): auto fixes
1 parent 3ca64ca commit f954494

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
117117
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
118118

119119
[^bokbokbok]: Inspired by [orchardbirds/bokbokbok](https://github.com/orchardbirds/bokbokbok)
120+
120121
[^autograd]: Inspired by [TomerRonen34/treeboost_autograd](https://github.com/TomerRonen34/treeboost_autograd)

src/boost_loss/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def eval_metric_lgb(
343343
self,
344344
y_true: NDArray | lgb.Dataset | xgb.DMatrix,
345345
y_pred: NDArray | lgb.Dataset | xgb.DMatrix,
346-
sample_weight: NDArray | lgb.Dataset | xgb.DMatrix | None = None
346+
sample_weight: NDArray | lgb.Dataset | xgb.DMatrix | None = None,
347347
# not used, exists for eval_metric_xgb_sklearn
348348
) -> tuple[str, float, bool]:
349349
"""LightGBM-compatible interface"""

src/boost_loss/regression/regression.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ def grad(self, y_true: NDArray, y_pred: NDArray) -> NDArray:
204204
return -y_true / (1 + np.exp(y_true * y_pred))
205205

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

211209

212210
class MSLELoss(LossBase):

src/boost_loss/regression/sklearn.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,32 +217,37 @@ def predict_raw(self, X: Any, **predict_params: Any) -> NDArray[Any]:
217217
def predict(
218218
self,
219219
X: Any,
220-
type_: Literal["mean", "median", "var", "std", "range", "mae", "mse"]
221-
| None = None,
220+
type_: (
221+
Literal["mean", "median", "var", "std", "range", "mae", "mse"] | None
222+
) = None,
222223
return_std: Literal[False] = False,
223224
**predict_params: Any,
224-
) -> NDArray[Any]:
225-
...
225+
) -> NDArray[Any]: ...
226226

227227
@overload
228228
def predict(
229229
self,
230230
X: Any,
231-
type_: tuple[
232-
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
233-
]
234-
| None = None,
231+
type_: (
232+
tuple[
233+
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
234+
]
235+
| None
236+
) = None,
235237
return_std: Literal[True] = ...,
236238
**predict_params: Any,
237-
) -> tuple[NDArray[Any], NDArray[Any]]:
238-
...
239+
) -> tuple[NDArray[Any], NDArray[Any]]: ...
239240

240241
def predict(
241242
self,
242243
X: Any,
243-
type_: Literal["mean", "median", "var", "std", "range", "mae", "mse"]
244-
| tuple[Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]]
245-
| None = None,
244+
type_: (
245+
Literal["mean", "median", "var", "std", "range", "mae", "mse"]
246+
| tuple[
247+
Literal["mean", "median"], Literal["var", "std", "range", "mae", "mse"]
248+
]
249+
| None
250+
) = None,
246251
return_std: bool = False,
247252
**predict_params: Any,
248253
) -> NDArray[Any] | tuple[NDArray[Any], NDArray[Any]]:

src/boost_loss/sklearn.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def apply_custom_loss(
3030
target_transformer: None = ...,
3131
recursive: bool = ...,
3232
recursive_strict: bool = ...,
33-
) -> TEstimator:
34-
...
33+
) -> TEstimator: ...
3534

3635

3736
@overload
@@ -46,8 +45,7 @@ def apply_custom_loss(
4645
target_transformer: BaseEstimator = ...,
4746
recursive: bool = ...,
4847
recursive_strict: bool = ...,
49-
) -> TransformedTargetRegressor:
50-
...
48+
) -> TransformedTargetRegressor: ...
5149

5250

5351
def apply_custom_loss(

0 commit comments

Comments
 (0)