-
Notifications
You must be signed in to change notification settings - Fork 236
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
Fix #168. Enforce float32 type for split condition values for GBT models created using XGBoost #188
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,50 +35,51 @@ | |
|
||
|
||
# Set of helper functions to make parametrization less verbose. | ||
def regression(model): | ||
def regression(model, test_fraction=0.02): | ||
return ( | ||
model, | ||
utils.get_regression_model_trainer(), | ||
utils.get_regression_model_trainer(test_fraction), | ||
REGRESSION, | ||
) | ||
|
||
|
||
def classification(model): | ||
def classification(model, test_fraction=0.02): | ||
return ( | ||
model, | ||
utils.get_classification_model_trainer(), | ||
utils.get_classification_model_trainer(test_fraction), | ||
CLASSIFICATION, | ||
) | ||
|
||
|
||
def classification_binary(model): | ||
def classification_binary(model, test_fraction=0.02): | ||
return ( | ||
model, | ||
utils.get_binary_classification_model_trainer(), | ||
utils.get_binary_classification_model_trainer(test_fraction), | ||
CLASSIFICATION, | ||
) | ||
|
||
|
||
def regression_random(model): | ||
def regression_random(model, test_fraction=0.02): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, unfortunately the default fraction produced way too few samples to be able to reproduce the issue reliably. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it! We definitely need to refactor testing routines to be more tunable, e.g. allow to adjust |
||
return ( | ||
model, | ||
utils.get_regression_random_data_model_trainer(0.01), | ||
utils.get_regression_random_data_model_trainer(test_fraction), | ||
REGRESSION, | ||
) | ||
|
||
|
||
def classification_random(model): | ||
def classification_random(model, test_fraction=0.02): | ||
return ( | ||
model, | ||
utils.get_classification_random_data_model_trainer(0.01), | ||
utils.get_classification_random_data_model_trainer(test_fraction), | ||
CLASSIFICATION, | ||
) | ||
|
||
|
||
def classification_binary_random(model): | ||
def classification_binary_random(model, test_fraction=0.02): | ||
return ( | ||
model, | ||
utils.get_classification_binary_random_data_model_trainer(0.01), | ||
utils.get_classification_binary_random_data_model_trainer( | ||
test_fraction), | ||
CLASSIFICATION, | ||
) | ||
|
||
|
@@ -92,6 +93,8 @@ def classification_binary_random(model): | |
FOREST_PARAMS = dict(n_estimators=10, random_state=RANDOM_SEED) | ||
XGBOOST_PARAMS = dict(base_score=0.6, n_estimators=10, | ||
random_state=RANDOM_SEED) | ||
XGBOOST_HIST_PARAMS = dict(base_score=0.6, n_estimators=10, | ||
tree_method="hist", random_state=RANDOM_SEED) | ||
XGBOOST_PARAMS_LINEAR = dict(base_score=0.6, n_estimators=10, | ||
feature_selector="shuffle", booster="gblinear", | ||
random_state=RANDOM_SEED) | ||
|
@@ -170,6 +173,14 @@ def classification_binary_random(model): | |
classification(xgboost.XGBClassifier(**XGBOOST_PARAMS)), | ||
classification_binary(xgboost.XGBClassifier(**XGBOOST_PARAMS)), | ||
|
||
# XGBoost (tree method "hist") | ||
regression(xgboost.XGBRegressor(**XGBOOST_HIST_PARAMS), | ||
test_fraction=0.2), | ||
classification(xgboost.XGBClassifier(**XGBOOST_HIST_PARAMS), | ||
test_fraction=0.2), | ||
classification_binary(xgboost.XGBClassifier(**XGBOOST_HIST_PARAMS), | ||
test_fraction=0.2), | ||
|
||
# XGBoost (LINEAR) | ||
regression(xgboost.XGBRegressor(**XGBOOST_PARAMS_LINEAR)), | ||
classification(xgboost.XGBClassifier(**XGBOOST_PARAMS_LINEAR)), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a more general solution will be to add an optional
dtype
constructor argument? I mean,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea 👍