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

[Hotfix] update hess and grad #43

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions mqboost/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def _hess_huber(error: np.ndarray, **kwargs) -> np.ndarray:

# Approx loss (MM loss)
def _grad_approx(error: np.ndarray, alpha: float, epsilon: float) -> np.ndarray:
_grad = 0.5 * (1 - 2 * alpha - error / (epsilon + np.abs(error)))
_grad = (1 - 2 * alpha - error / (epsilon + np.abs(error))) / 2
return _grad


def _hess_approx(error: np.ndarray, epsilon: float, **kwargs) -> np.ndarray:
_hess = 1 / (2 * (epsilon + np.abs(error)))
_hess = 1 / (2 * (1 + epsilon + np.abs(error)))
return _hess


Expand Down
Loading