clearml-docs/docs/guides/frameworks/xgboost/xgboost_sample.md

47 lines
2.1 KiB
Markdown
Raw Normal View History

2021-05-13 23:48:51 +00:00
---
2022-01-02 14:23:06 +00:00
title: XGBoost and scikit-learn
2021-05-13 23:48:51 +00:00
---
2025-02-13 08:48:26 +00:00
The [xgboost_sample.py](https://github.com/clearml/clearml/blob/master/examples/frameworks/xgboost/xgboost_sample.py)
2022-01-13 07:42:36 +00:00
example demonstrates integrating ClearML into code that uses [XGBoost](https://xgboost.readthedocs.io/en/stable/).
2021-05-13 23:48:51 +00:00
2022-01-13 07:42:36 +00:00
The example does the following:
* Trains a network on the scikit-learn [iris](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_iris.html#sklearn.datasets.load_iris)
classification dataset using XGBoost
* Scores accuracy using scikit-learn
* ClearML automatically logs the input model registered by XGBoost, and the output model (and its checkpoints),
feature importance plot, and tree plot created with XGBoost.
2025-02-06 15:31:11 +00:00
* Creates a task named `XGBoost simple example` in the `examples` project.
2021-05-13 23:48:51 +00:00
## Plots
2025-02-06 15:31:11 +00:00
The feature importance plot and tree plot appear in the task's page in the **ClearML web UI**, under
2021-05-13 23:48:51 +00:00
**PLOTS**.
2025-03-06 05:43:50 +00:00
![Feature importance plot](../../../img/examples_xgboost_sample_06.png#light-mode-only)
![Feature importance plot](../../../img/examples_xgboost_sample_06_dark.png#dark-mode-only)
2025-03-06 05:43:50 +00:00
![Tree plot](../../../img/examples_xgboost_sample_06a.png#light-mode-only)
![Tree plot](../../../img/examples_xgboost_sample_06a_dark.png#dark-mode-only)
2021-05-13 23:48:51 +00:00
2021-05-18 22:31:01 +00:00
## Console
2021-05-13 23:48:51 +00:00
2022-05-22 07:27:30 +00:00
All other console output appear in **CONSOLE**.
2021-05-13 23:48:51 +00:00
2025-03-06 05:43:50 +00:00
![Console log](../../../img/examples_xgboost_sample_05.png#light-mode-only)
![Console log](../../../img/examples_xgboost_sample_05_dark.png#dark-mode-only)
2021-05-13 23:48:51 +00:00
## Artifacts
2025-02-06 15:31:11 +00:00
Models created by the task appear in the task's **ARTIFACTS** tab. ClearML automatically logs and tracks
2022-01-13 07:42:36 +00:00
models and any snapshots created using XGBoost.
2021-05-13 23:48:51 +00:00
2025-03-06 05:43:50 +00:00
![Artifacts](../../../img/examples_xgboost_sample_10.png#light-mode-only)
![Artifacts](../../../img/examples_xgboost_sample_10_dark.png#dark-mode-only)
2021-05-13 23:48:51 +00:00
2023-10-01 07:31:48 +00:00
Clicking on the model's name takes you to the [model's page](../../../webapp/webapp_model_viewing.md), where you can
view the model's details and access the model.
2021-05-13 23:48:51 +00:00
2025-03-06 05:43:50 +00:00
![Model details](../../../img/examples_xgboost_sample_03.png#light-mode-only)
![Model details](../../../img/examples_xgboost_sample_03_dark.png#dark-mode-only)