MCPcopy Create free account
hub / github.com/dmlc/xgboost / hist_train

Function hist_train

demo/guide-python/external_memory.py:137–153  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

135
136
137def 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
156def approx_train(it: Iterator) -> None:

Callers 1

mainFunction · 0.70

Calls 3

ExtMemQuantileDMatrixMethod · 0.45
trainMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected