Files
FLAML/test/default_xgb.py
Gleb Levitski 3de0dc667e Add ruff sort to pre-commit and sort imports in the library (#1259)
* lint

* bump ver

* bump ver

* fixed circular import

---------

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
2024-03-12 21:28:57 +00:00

14 lines
424 B
Python

from flaml.automl.data import load_openml_dataset
from flaml.automl.ml import sklearn_metric_loss_score
from flaml.default import XGBClassifier
X_train, X_test, y_train, y_test = load_openml_dataset(dataset_id=1169, data_dir="./")
xgb = XGBClassifier()
xgb.fit(X_train, y_train)
y_pred = xgb.predict(X_test)
print(
"flamlized xgb accuracy =",
1 - sklearn_metric_loss_score("accuracy", y_pred, y_test),
)
print(xgb)