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

Function run_threaded_predict

tests/python/test_predict.py:16–29  ·  view source on GitHub ↗
(X, rows, predict_func)

Source from the content-addressed store, hash-verified

14
15
16def run_threaded_predict(X, rows, predict_func):
17 results = []
18 per_thread = 20
19 with ThreadPoolExecutor(max_workers=10) as e:
20 for i in range(0, rows, int(rows / per_thread)):
21 if hasattr(X, "iloc"):
22 predictor = X.iloc[i : i + per_thread, :]
23 else:
24 predictor = X[i : i + per_thread, ...]
25 f = e.submit(predict_func, predictor)
26 results.append(f)
27
28 for f in results:
29 assert f.result()
30
31
32@pytest.mark.parametrize("DMatrixT", [xgb.DMatrix, xgb.QuantileDMatrix])

Callers 3

test_predictMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected