-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ad9c35
commit 5b5e243
Showing
2 changed files
with
31 additions
and
1 deletion.
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
28 changes: 28 additions & 0 deletions
28
tests/unit/test_automl/test_presets/test_tabularautoml_xgb.py
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,28 @@ | ||
from sklearn.metrics import roc_auc_score | ||
|
||
from lightautoml.automl.presets.tabular_presets import TabularAutoML | ||
from lightautoml.tasks import Task | ||
from tests.unit.test_automl.test_presets.presets_utils import check_pickling | ||
from tests.unit.test_automl.test_presets.presets_utils import get_target_name | ||
|
||
|
||
class TestTabularAutoMLXGB: | ||
def test_fit_predict(self, sampled_app_train_test, sampled_app_roles, binary_task): | ||
# load and prepare data | ||
train, test = sampled_app_train_test | ||
|
||
# run automl | ||
automl = TabularAutoML(task=binary_task, general_params={"use_algos": [["xgb"]]}) | ||
oof_predictions = automl.fit_predict(train, roles=sampled_app_roles, verbose=10) | ||
ho_predictions = automl.predict(test) | ||
|
||
# calculate scores | ||
target_name = get_target_name(sampled_app_roles) | ||
oof_score = roc_auc_score(train[target_name].values, oof_predictions.data[:, 0]) | ||
ho_score = roc_auc_score(test[target_name].values, ho_predictions.data[:, 0]) | ||
|
||
# checks | ||
assert oof_score > 0.65 | ||
assert ho_score > 0.65 | ||
|
||
check_pickling(automl, ho_score, binary_task, test, target_name) |