I have a data set that looks like this:


The variable target is 0-1 outcome. The feature "items" is a set of items (variable length). Each item is a categorical variable (one of: i1, i2, .., i_N). There's no order/relationship between the items. A business example would be "set of products in a cart, outcome whether the customer abandons cart".

The size of data is approx. 1,000,000 by 5,000 (I have ~1 million examples, and N is approximately 5,000)

I want to do the following analysis. I want to find the items that influence (or lead to) target = 1. I don't have extra features to add. What is the type of statistical analysis or machine learning modelling technique that I should use?


1 Answer 1


How large is N? Can you reshape your data into something like:

target   i1  i2  i3  i4  i5 ... i9 ... iN
     1    1   0   1   0   0 ...  0 ...  0        
     1    0   0   0   1   1 ...  1 ...  0
     0    1   0   0   0   0 ...  0 ...  0

Once you have fit everything into a data frame, you can use any two-class supervised classification algorithm to build your model. There is no "best" model in general, but try a few to see which one works the best with your data.

Sorry for posting as an answer; comment doesn't allow preformatted text.

  • $\begingroup$ Yes, I can format the data this way. It's approximately 1,000,000 example by 5,000 features. After finding a good model, how does I answer my original question: here are the items that has the most influence on outcome=1? $\endgroup$
    – Edward B.
    Commented Jun 14, 2018 at 16:57
  • $\begingroup$ Is it correct to compute correlation(target, i1), correlation(target, i2) etc and take the columns with top values of correlation? Is that a correct approach from statistics point of view? $\endgroup$
    – Edward B.
    Commented Jun 14, 2018 at 16:59
  • 2
    $\begingroup$ Run a Gradient Boosting Algorithms (whatever you like XGBoost,Catboost, LightGBM) on the dataframe suggested by @The Lyrics. Once trained, you can easily look at feature importance and you will see which variable(s) (product(s) in your case) has been most informative on your target prediction. if you want to take it further you can look at shap values (github.com/slundberg/shap) instead of feature importance which gives you many more insights including dependency plots (or correlation if you wish). $\endgroup$ Commented Jun 14, 2018 at 18:25

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.