The hist tree method can use a special data structure `ExtMemQuantileDMatrix` for faster initialization and lower memory usage (recommended). .. versionadded:: 3.0.0
(it: Iterator)
| 135 | |
| 136 | |
| 137 | def hist_train(it: Iterator) -> None: |
| 138 | """The hist tree method can use a special data structure `ExtMemQuantileDMatrix` for |
| 139 | faster initialization and lower memory usage (recommended). |
| 140 | |
| 141 | .. versionadded:: 3.0.0 |
| 142 | |
| 143 | """ |
| 144 | # For non-data arguments, specify it here once instead of passing them by the `next` |
| 145 | # method. |
| 146 | Xy = xgboost.ExtMemQuantileDMatrix(it, missing=np.nan, enable_categorical=False) |
| 147 | booster = xgboost.train( |
| 148 | {"tree_method": "hist", "max_depth": 4, "device": it.device}, |
| 149 | Xy, |
| 150 | evals=[(Xy, "Train")], |
| 151 | num_boost_round=10, |
| 152 | ) |
| 153 | booster.predict(Xy) |
| 154 | |
| 155 | |
| 156 | def approx_train(it: Iterator) -> None: |
no test coverage detected