It's a project that I'm working on. Here are the steps I took:

I want to make a recommendation service based on the customer data. I first used a collaborative filtering method to get the recommended products. Then I am trying to use that result as a target variable of my random forest model.

The specifics:

  1. My data: Columns A, B, C, D, E, F. Each row indicates each customer.
  2. Do unsupervised learning(collaborative filtering) to make a recommendation. Only used column A (which has information about the products they have bought) Choose one recommendation product for each customer, and make that into a categorical column
  3. Merge that column with the original data, and take out column A
  4. My data: Columns B, C, D, E, F, NEW_COLUMN
  5. Use supervised learning to get important features that explains the NEW_COLUMN
  6. I am trying to use supervised learning on the NEW_COLUMN because I want to get some useful predictions that could be used to explain the reason for the NEW_COLUMN(the recommended products)

This is the path that I'm taking. However, is it okay to do predictive modeling with the data that I made using predictive modeling?

Also, if there are any references, it would be a great help!

  • $\begingroup$ Generally, a pipeline that uses unsupervised methods and then supervised methods might make sense. Still, in order to get more helpful answers you should describe the problem you are trying to solve and why you have chosen using this method. $\endgroup$
    – yoav_aaa
    Commented Oct 29, 2019 at 11:53
  • $\begingroup$ @yoav_aaa Thanks for the tip. I added more information to the question :) $\endgroup$
    – G K
    Commented Oct 31, 2019 at 2:29
  • $\begingroup$ Could you further explain the goal of the random forest model? What are you using it for? $\endgroup$ Commented Oct 31, 2019 at 4:18
  • $\begingroup$ @RomainReboulleau I'm trying to use the RF model to select feature importance. I thought it could give me insights whether there are any hidden patterns in the customer's traits that explains the 'why' for the recommended product. $\endgroup$
    – G K
    Commented Oct 31, 2019 at 5:21

1 Answer 1


Your approach seems valid. It is not even biaised because you don't use other features than A to build F.

Performing unsupervised learning prior to supervised learning in a very common approach, and there are numerous types of workflows where supervised and unsupervised techniques are combined to solve the problem.

However, be careful with random forest feature importance: there are several ways to compute importances, and not all will give the same results. There are also other techniques to make complex models interpretable, such as LIME for local explanation or SHAP values for both local and global explanation.


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.