(X, rows, predict_func)
| 14 | |
| 15 | |
| 16 | def 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]) |
no outgoing calls
no test coverage detected