Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pre-commit.ci): pre-commit autoupdate #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md|.copier-answers.yml"
default_stages: [commit]
default_stages: [pre-commit]

ci:
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate"

repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.30.1
rev: v4.0.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: debug-statements
- id: check-builtin-literals
Expand All @@ -28,11 +28,11 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-poetry/poetry
rev: 1.7.1
rev: 1.8.0
hooks:
- id: poetry-check
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ["--tab-width", "2"]
Expand All @@ -42,36 +42,36 @@ repos:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: ["attrs"]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
rev: 1.8.0
hooks:
- id: bandit
args: [-x, tests]
- repo: https://github.com/srstevenson/nb-clean
rev: "3.2.0"
rev: "4.0.1"
hooks:
- id: nb-clean
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

[^bokbokbok]: Inspired by [orchardbirds/bokbokbok](https://github.com/orchardbirds/bokbokbok)

[^autograd]: Inspired by [TomerRonen34/treeboost_autograd](https://github.com/TomerRonen34/treeboost_autograd)
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 @@
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
Loading