TreeParam: is it safe to add new member variables?

Hello,

I’m looking to add a new integer member variable to the TreeParam class.

The first time I did that I hit a static assert in line 48 of TreeParam that seems to have hardcoded the byte size of the class.

Currently I have a workaround that adds one more integer member variable to the size calculation, but I’m curious if that might lead to trouble in the future, and what’s the purpose of the 64bit alignment.

TreeParam gets dumped into the model file, so no, it is not safe to add a new member.

There was a discussion about adding instance counts to NodeStat, and a similar problem arose: Saving instance counts in XGBoost model without breaking backward compatibility

Maybe we should consider migrating to an extensible model storage format, such as JSON.

Hmm, for a new variant of the model I’m trying out I need to be carrying some extra information for each tree.

Assuming I only train and not save/load model explicitly, will adding new parameters cause any issues? I know rabit tries to write the model at the end of the learning process but that’s about it.

That’s the only issue I can come up with, so if your use case doesn’t involve saving/loading models, it should be fine for experiment purposes.