0
$\begingroup$

I expected that reducing the precision of my data (e.g., from int64 to int8) would speed up the training. But, even if I reduce the overall size of my dataset by 74%, I do not see an improvement. Is this expected?

$\endgroup$
5
  • $\begingroup$ In case you are using XGBoost for Python: do you pass your data as DMatrix()? $\endgroup$ Oct 19, 2022 at 14:17
  • $\begingroup$ no, as a Pandas dataframe $\endgroup$
    – shamalaia
    Oct 20, 2022 at 5:50
  • 2
    $\begingroup$ Why is there an expectation that reducing the data type size would reduce training time? $\endgroup$
    – Craig
    Oct 20, 2022 at 11:24
  • $\begingroup$ Because it would reduce memory usage. Why does it not make sense? $\endgroup$
    – shamalaia
    Oct 20, 2022 at 11:35
  • 1
    $\begingroup$ It probably won't play a role in case you are training on all available data and that data fits into memory as a whole. However, if your data does not fit into memory then this will reduce the process of loading data into memory continuously. $\endgroup$ Oct 20, 2022 at 11:38

2 Answers 2

0
$\begingroup$

I think you should pass the data directly as DMatrix(), XGBoosts internal data type. As stated in the official documentation:

DMatrix is an internal data structure that is used by XGBoost, which is optimized for both memory efficiency and training speed. You can construct DMatrix from multiple different sources of data.

I think this also answers your question, since XGBoost is optimized for DMatrix(), the impact of changes like yours will be small at best.

$\endgroup$
1
  • $\begingroup$ Using the Learning API actually sped up almost 7X the train time. Thanks! But, again, reducing the float precision did not improve the performance. $\endgroup$
    – shamalaia
    Oct 20, 2022 at 11:12
0
$\begingroup$

Changing float precision cannot make any difference as "XGBoost treats all data as 32-bit float internally."

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.