I am using the c-api library in a C++ project. I understand that I need to set the seed to reproduce the same results - like set.seed() in R - but not sure how I do about that. If I try to set the booster parameter to a set value, I still see different models/predictions for the same data. What do I need to do?
Did you set the
seed parameter? Setting the
seed parameter should work.
Thanks- I was, but it seems my features were not being initialized properly. I’m just getting my head around using xgboost library and I really appreciate the quick response
My features weren’t being initialized properly because of subtle errors resulting from our converting a simple code example, which puts features and tests in local stack two-dimensional arrays. We wanted to change these arrays to be allocated dynamically on the stack, but this appears to result in data corruption. The forecasts that are generated are nearly correct, but clearly off and volatile (causing us to think that the random number seed was what was causing the forecasts to vary every time we ran the engine).
Can someone steer me to a code example that uses a dynamically allocated array to call XGDMatrixCreateFromMat?