-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] introduce weighted loss (#8)
* introduce weighted loss * remove optimize based on optuna * refactor objective
- Loading branch information
Showing
9 changed files
with
133 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# ruff: noqa | ||
from imlightgbm.engine import cv, optimize, train | ||
from imlightgbm.engine import cv, train |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from enum import Enum | ||
|
||
|
||
class BaseEnum(str, Enum): | ||
@classmethod | ||
def get(cls, text: str) -> Enum: | ||
cls.__check_valid(text) | ||
return cls[text] | ||
|
||
@classmethod | ||
def __check_valid(cls, text: str) -> None: | ||
if text not in cls._member_map_.keys(): | ||
valid_members = ", ".join(list(cls._member_map_.keys())) | ||
raise ValueError( | ||
f"Invalid value: '{text}'. Expected one of: {valid_members}." | ||
) | ||
|
||
|
||
class SupportedTask(BaseEnum): | ||
binary: str = "binary" | ||
multiclass: str = "multiclass" | ||
|
||
|
||
class Metric(BaseEnum): | ||
auc: str = "auc" | ||
binary_logloss: str = "binary_logloss" | ||
binary_error: str = "binary_error" | ||
auc_mu: str = "auc_mu" | ||
multi_logloss: str = "multi_logloss" | ||
multi_error: str = "multi_error" | ||
|
||
|
||
class Objective(BaseEnum): | ||
focal: str = "focal" | ||
weighted: str = "weighted" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.