Skip to content

Commit

Permalink
remote unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
YJ Shi committed Jul 27, 2022
1 parent 4c9eca2 commit 2c80287
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions python/tvm/meta_schedule/cost_model/xgb_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,36 +645,6 @@ def average_peak_score(ys_pred: np.ndarray):
return eval_result


def custom_callback(
early_stopping_rounds: int,
verbose_eval: int,
fevals: List[Callable],
evals: List[Tuple["xgb.DMatrix", str]],
focused_metric: str = "tr-p-rmse",
):
"""Callback function for xgboost to support multiple custom evaluation functions"""
sort_key = make_metric_sorter(focused_metric=focused_metric)

state: Dict[str, Any] = {}

def init(env: "xgb.core.CallbackEnv"):
"""Internal function"""
booster: "xgb.Booster" = env.model

state["best_iteration"] = 0
state["best_score"] = float("inf")
if booster is None:
assert env.cvfolds is not None
return
if booster.attr("best_score") is not None:
state["best_score"] = float(booster.attr("best_score"))
state["best_iteration"] = int(booster.attr("best_iteration"))
state["best_msg"] = booster.attr("best_msg")
else:
booster.set_attr(best_iteration=str(state["best_iteration"]))
booster.set_attr(best_score=str(state["best_score"]))


class XGBoostCustomCallback(TrainingCallback):
"""Custom callback class for xgboost to support multiple custom evaluation functions"""

Expand Down

0 comments on commit 2c80287

Please sign in to comment.