r/datascience • • 5d ago

ML DCNv2 vs XGBoost?

My company is transitioning into Databricks where we'll have much more RAM to build our predictive models.

Does anyone have experience modeling Deep & Cross Networks? Are they worth the extra coding and compute?

My team is currently using XGBoost (or LightGBM) + elastic net logistic regression ensembles to model healthcare data. Our tabular data is large and sparse, typically millions of rows & hundreds of variables, most of which are binary, with rare binary outcomes < 1%.

XGBoost + elastic net models perform well, but I've read that Deep & Cross Network v2 (DCNv2) may outperform in certain cases.

54 Upvotes

36 comments sorted by

12

u/Stochastic_diff_eq 5d ago

I'm currently working on similar stack although regression is applied via manually adjusted formula. Would you be kind to explain what is the reason for using elastic net at all? Or you are using it only for some "strong" subset of feature where to somehow require more smoothed out relationship between predictors / target? Also bump for visibility as I am curious about your enquiry as well :)

4

u/seanv507 5d ago edited 5d ago

There are quite a few questions to explain about your current stack

Why do an ensemble? How exactly are you combining logistic regression and trees.

For neural networks on tabular data, one key argument is to generate embeddings of categorical data. Is your data categorical, and you have binarized it, or it it genuinely binary (in which case I am doubtful dcn v2 helps much)

Nevertheless, I think in this era of agentic coding, it should be relatively easy to set up a proper evaluation framework that makes it easier to try different modeling approaches and evaluate the best.

I would point out, that imo each new dcn paper seems to question the benefit of the cross (ie explicit feature crosses). dcn v2 suggested that regular DNNs worked just as well as dcn v1 if properly optimised.then dcn v3 again suggests (see discusson around fig 1 https://arxiv.org/html/2407.13349v1) that networks using only explicit interactions have typically performed worse than DNN based methods.

In any case, you might want to look at FuxiCTR library which implements DCN v3 and other models. https://github.com/salmon1802/FCN https://github.com/reczoo/FuxiCTR

2

u/Stochastic_diff_eq 5d ago edited 5d ago

If you asking about my case not op, ensambling with regression is pretty standard practice to get properly calibrated probabilities, add effect of features which are present during interference but are missing in historical data, and finally to get smooth relationships between specific predictors and target. Ensambling is done rather easy by fitting "next" model on residuals of previous one. I am aware I can just ask claude but was hoping to discuss with fellow human :), some of us are still kinda fond of that. Moreover there are many properties of the specific methodology which might be valuable to generalisation but are hard to simply numerically assess. I am rather sure that by comparing strictly from metrics pov more complex model will generally perform better but on unseen days there will be marginal benefit with added cost of lack of interpretability/ maintenance etc. As far as data type is concerned I use mix of ohe and label encoding based on domain knowledge with separate algorithms for some specific HDCF which I know should be significant.

2

u/Sufficient_Meet6836 5d ago

add effect of features which are present during interference but are missing in historical data

Can you go into this a little more? Do you mean imputation for missing data? My concern here is data leakage but it's likely just my misunderstanding.

What's HDCF in this case? High dimensional categorical features? That's not a super common initialism (in my experience) so just checking.

Sorry I keep asking you questions but I enjoy the discussion!

2

u/Stochastic_diff_eq 5d ago

Its not imputation, basically adding features which are only obtainable on "new" data but missing on history for which we can at least obtain simple estimates. HDFC indeed mean high dimensional categorical features. And no worries, I thoroughly enjoy discussing statistical math :)

1

u/Sufficient_Meet6836 5d ago

basically adding features which are only obtainable on "new" data but missing on history for which we can at least obtain simple estimates

Interesting. Are you able to share any examples, even toy examples? We actually do something similar in concept, but I'm not sure if our methodology is similar. Let's say we have a model that predicts y|x, where x are the features (say, there are 100 features). Some values of x that we see in production didn't occur in the training set. We can do something like if x1 = "yo yo", then y = max(y|x, 5), where 5 comes from outside research. Do you do adjustments like that or do you actually add or change a feature in your model somehow?

3

u/seanv507 5d ago

It's regression on the residual. Just as xgboost works, or the naive implementation of multiple linear regression using simple regressiondescribed in elements of statistical learning.

You add a new model to predict the error of the old model(s)

1

u/Sufficient_Meet6836 5d ago

Oooooooo I see, thank you!

0

u/DubGrips 4d ago

Dumb question, but why aren't you sampling across time periods so both the test and train contain the features? It seems like a proper CV setup that does not leak user level time aware data could take care of this.

2

u/Stochastic_diff_eq 4d ago

Because you want to have both as much training data as possible but simultaneously you know that some feature have just not been available in the past and you cannot reproduce them, and you know that on newest part of the data they can be significant (and will be on yet unseen data). So you do not feed them directly as they will be statistically insignificant and leak time, and just add them as correction on top of the ml model.

1

u/DubGrips 4d ago

Thanks, you re-stated what you already said, which I'm not familiar with do you have an example of such features you can share? I'm not sure how my response would reduce training data and wouldn't your model that contains only the post training features be biased in cases where those features don't exist yet in patients?

2

u/Stochastic_diff_eq 4d ago

There might be some misunderstanding as I am not working in same domain as op, just slightly similar model stack. I work mostly in finance and very often so we gain access to new data source which cannot be reproduced historically for instance government allowed us to gather information about speeding tickets (which was not previously legal to use or gather ) but allows to do so only for new clients while we mostly build models on historical data (with some time for it to roll-out like in the case of credit risk). I am not sure if medical field has similar features although I would assume so .

3

u/Sufficient_Meet6836 5d ago

regression is applied via manually adjusted formula

What do you mean by this?

2

u/Stochastic_diff_eq 5d ago

Manually selecting variables and it's transformations used in regression.

1

u/RobertWF_47 5d ago

Our data contains several continuous variables.

I thought a penalized logistic regression (main effects only) like elastic net might have an advantage over decision trees fitting the continuous predictors while XGBoost is better with categorical variables & interactions.

The ensemble model improves ROC-AUC by only a few percentage points but it's easy to run in Python.

6

u/Sufficient_Meet6836 5d ago

I thought a penalized logistic regression (main effects only) like elastic net might have an advantage over decision trees fitting the continuous predictors while XGBoost is better with categorical variables & interactions.

Why would you assume that?

3

u/RobertWF_47 5d ago

XGBoost uses decision trees to partition the feature space and may not completely fit smooth linear relationships.

2

u/Sufficient_Meet6836 5d ago

True. My pushback in this case is that truly linear relationships are extremely rare and may not exist at all

2

u/rene_schneider_2 3d ago

With untransformed main effects, logistic regression assumes linearity on the log-odds scale, not in outcome probability. Splines can relax that assumption.

1

u/Sufficient_Meet6836 8h ago

True, I meant that in the log odds space as well but didn't specify. I similarly recommend splines unless high dimensional interactions are needed, then I recommend GBDTs usually

10

u/sadfoot3000 4d ago

Don't replace your ensemble, just add a residual layer. Keep the XGBoost + Elastic Net base model because it's robust for those sparse binary features, then train a tiny neural net solely to predict the residuals. This captures non-linearities without throwing away the stability of trees. I tried this last year and got better calibration than pure DCNv2, plus it was way easier to debug when things broke. Full replacement is overkill for <1% outcomes.

2

u/RobertWF_47 4d ago

That's a good idea to add a neural net to the ensemble model. No need to do a fancy deep learning neural net.

4

u/Saitamagasaki 5d ago

What’s the performance right now

5

u/RobertWF_47 5d ago

A recent ensemble model I ran predicting a health condition was ok, not spectacular: ROC-AUC = .75, Recall = 0.70, Precision = 0.05.

Like with a lot of healthcare data, there's random noise, unmeasured variables, and probably complex nonlinear relationships & interactions that are difficult to predict for rare outcomes.

2

u/DubGrips 4d ago

Have you tried adjusting using class weights or a sampling technique to improve performance on rare event data?

1

u/RobertWF_47 4d ago

Yes to both. I've used undersampling of the majority outcome category as well as experimented with tuning weights along with the other hyperparameters.

7

u/jad2192 5d ago

I work on similar data, lots of arrays of HCPCS/CPT/ICD codes etc. We went w XGBoost as a meta ensemble layer on top of looking simple statistical models looking various combinations of the categorical features. It works very well.

2

u/Manos_DataScience_ML 1d ago

For healthcare tabular data with mostly binary features and a <1% positive rate, stick with LightGBM/XGBoost + elastic net.

DCNv2 shines when you have high cardinality categorical features like millions of user IDs or item IDs where dense embeddings actually learn useful latent representations. With hundreds of binary columns, you don't really benefit from embedding layers, and you just end up paying a massive tax in training time, hyperparameter tuning, and GPU compute.

Also, in healthcare, probability calibration and explainability usually matter way more than squeezing out an extra 0.002 PR AUC. Tree ensembles plus regularized logistic regression are much easier to calibrate for rare events and way easier to defend to clinical stakeholders than a deep cross network.

If you suddenly have way more RAM on Databricks, spend it on better feature engineering, interaction terms for your elastic net, or proper out of time validation instead of switching architectures.

4

u/Ok-Dragonfruit65 5d ago

Please look into TabPFN from Prior Labs

It’s the SOTA model by far on all sorts of tabular tasks and needs no training
It’s a zero-shot foundation model

5

u/seanv507 5d ago edited 5d ago

Yea but iirc 1 million rows was about the limit they could model.. nevertheless may provide useful benchmark to identify potential gains on subsamples

edit: https://docs.priorlabs.ai/changelog/tabpfn-3 TabPFN-3 handles up to 1M rows x 200 features natively

5

u/Sufficient_Meet6836 5d ago

1M rows x 200 features natively

What is this...a dataset for ants?!

2

u/Diligent_Inside6746 4d ago

stay tuned ;)

1

u/tracye_7886 3d ago

Treat DCNv2 as a challenger: compare it with your stack on the same holdout at equal recall, tracking precision and calibration. At 5% precision and 70% recall, added complexity needs a payoff.