Skip to content

feature: add warnings for xgboost specific rules in debugger rules #3255

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

Merged
merged 1 commit into from
Aug 2, 2022
Merged
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
12 changes: 12 additions & 0 deletions src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ def _prepare_rules(self):
if self.rules is not None:
for rule in self.rules:
if isinstance(rule, Rule):
# Add check for xgboost rules
self._check_debugger_rule(rule)
self.debugger_rules.append(rule)
elif isinstance(rule, ProfilerRule):
self.profiler_rules.append(rule)
Expand All @@ -788,6 +790,16 @@ def _prepare_rules(self):
+ "and sagemaker.debugger.ProfilerRule"
)

def _check_debugger_rule(self, rule):
"""Add warning for incorrectly used xgboost rules."""
_xgboost_specific_rules = ["FeatureImportanceOverweight", "TreeDepth"]
if rule.name in _xgboost_specific_rules:
logger.warning(
"TreeDepth and FeatureImportanceOverweight rules are valid "
"only for the XGBoost algorithm. Please make sure this estimator "
"is used for XGBoost algorithm. "
)

def _prepare_debugger_for_training(self):
"""Prepare debugger rules and debugger configs for training."""
if self.debugger_rules and self.debugger_hook_config is None:
Expand Down