From 53f0361c0fc50e25b7c385543cb21e3de60dd722 Mon Sep 17 00:00:00 2001 From: fis Date: Tue, 13 Jul 2021 16:38:30 +0800 Subject: [PATCH] Comments. --- demo/guide-python/external_memory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demo/guide-python/external_memory.py b/demo/guide-python/external_memory.py index 76853b4cf2b1..d63e5410b769 100644 --- a/demo/guide-python/external_memory.py +++ b/demo/guide-python/external_memory.py @@ -14,6 +14,7 @@ def make_batches( n_samples_per_batch: int, n_features: int, n_batches: int ) -> Tuple[List[np.ndarray], List[np.ndarray]]: + """Generate random batches.""" X = [] y = [] rng = np.random.RandomState(1994) @@ -26,6 +27,7 @@ def make_batches( class Iterator(xgboost.DataIter): + """A custom iterator for loading files in batches.""" def __init__(self, file_paths: List[Tuple[str, str]]): self._file_paths = file_paths self._it = 0 @@ -76,7 +78,7 @@ def main(tmpdir: str) -> xgboost.Booster: Xy = xgboost.DMatrix(it) # Other tree methods including ``hist`` and ``gpu_hist`` also work, but has some - # caveats as noted in following sections. This is still an experimental feature. + # caveats. This is still an experimental feature. booster = xgboost.train({"tree_method": "approx"}, Xy) return booster