r/MLQuestions • • 11d ago

Beginner question 👶 Xgboost models fails to capture dynamics across training data batches.

Post image

Hi everyone, I have an mlr3 based toolset in R for regression models for process sensor time series data. This is my largest project to date with roughly 30 input features that are also lagged and rolled to inject temporal memory. Due to the difficulty of carefully weighting training size on a 1 minute sampling rate vs. relative weight of dynamic changes I switched to a batching scheme and now use LOBO on currently 4 train batches. This is just a pilot mode plot where it only trains on 5-10% of input data so feature to data point ratio is less than ideal. The result of a full run is the same though.

Hyperband tunes nrounds 16-512 with eta 2-3 for an xgboost model. The result is a strong deviation from baseline, extremely low skill against persistence and xgboost mostly hunting to find some sort of baseline with strong bias rather than capturing any dynamics. Although persistence is overly optimistic here as target is dampened by some technical details independent of data handling. This is accounted for as best as possible by injected retention time and holdup features. Target and features are real on-stream data.

How do I best proceed from here? I feel like I am missing something because rolling window cross validation within batch produced much better results but missed the optimization goal of optimizing across batches. Right now I take great care in preserving temporal alignment across batches and index data to preserve integrity across batches.

```

INFO [22:03:49.004] [bbotk] Finished optimizing after 69 evaluation(s)

INFO [22:03:49.007] [bbotk] Result:

INFO [22:03:49.015] [bbotk] eta max_depth min_child_weight lambda subsample colsample_bytree

INFO [22:03:49.015] [bbotk] <num> <int> <num> <num> <num> <num>

INFO [22:03:49.015] [bbotk] -3.398853 3 1.909219 -0.775668 0.8 0.8

INFO [22:03:49.015] [bbotk] nrounds x_domain objective

INFO [22:03:49.015] [bbotk] <num> <list> <num>

INFO [22:03:49.015] [bbotk] 19 <list\[7\]> 26.70044

```

11 Upvotes

12 comments sorted by

6

u/kmishra9 11d ago

Is it bad that I’m a senior data scientist and I didn’t understand half the jargon this person said in paragraph 2?

I feel like tagging this as a beginner question is icing on the cake.

4

u/Lost_property_office 11d ago

see, these are the hoops graduates expected to jump these days, only getting rejected from an entry level position.

And there you go, senior living the reality.

1

u/Resident-Apricot3212 11d ago

I am a professional outside of the ML / data science / data engineer field dabbling in it with LLM help and just looking to solve an actual problem I encountered.

1

u/kmishra9 10d ago

For sure, not tryna throw shade, but I just a) can't help ya and b) didn't understand the intricacies of the problems with tuning that you're running into, and thought "is it just me...?" Does everyone just know what "extremely low skill against persistence" is?

1

u/Resident-Apricot3212 11d ago

Is there something in particular I can clarify or elaborate on?

I am looking for tuning advice for xgboost on time series data.

1

u/trolls_toll 10d ago

how do simpler model perform?

1

u/Resident-Apricot3212 10d ago

Great hint. Sometimes you are too close and miss simple things. I picked an existing PID controller loop (so some linearity was a given) and model failed to predict even the baselines across all batches.

I am currently in the process of checking whether mlr3 tuner called hyperband is the cause. Its intended to play nice with xgboost without early stopping but can throw out promising hyperparameters

2

u/trolls_toll 10d ago

throw away your boosted trees for now, and consider testing things with the simplest possible model, like ar(1). Once you get a complete pipeline running, you could start tweaking models. Think very carefully how you calculate the errors between real and predicted data

1

u/Resident-Apricot3212 1d ago

I have continued fiddling with the pipeline. A culprit was an overly aggressive IQR filter that virtually smoothed all data und received a changed threshold.

I also learnt that tree models really struggle with calculating absolute levels solely from external regressors and introduced the previous value of target.

Both measures substantially improved model performance and workflow is finally running. For ease of testing I introduced glmnet and random forest as well to avoid entire rewrites.

Thanks so much for the input. I was at my wits end and you guys helped me push through.

0

u/[deleted] 10d ago

[deleted] — view deleted comment

1

u/kmishra9 10d ago

Random forests will give you 80-95% of the performance of a GBM and work out of the box with zero hyperparam tuning and cross validation required, and with a nice hardcoded ~100 trees. They CAN be tuned, but don’t 100% need it to at least fit to your data in a reasonable way.

They’re nonlinear and capture feature interactions implicitly — if tuning is troublesome (it sounds like it is) and you’re trying to be simple, throw an RF at your problem and see what you see.

1

u/Vegetable_Race_1881 4d ago

Interesting Observation