Using Random Forest model to predict segment membership

Toni Gril
22. 04. 2015

Background

The application is based on proprietary survey data of 1.900 beer drinkers in Slovenia. First, the segmentation was performed on the reported beer purchase and attitudinal data.

Motivation

In order to classify respondents in future shorter surveys and for recruiting focus group participants, Random Forest model was trained and validated on data that included a subset of reported beer purchase data and some demographics:

  • gender |age
  • number of brands respondent knows about
  • frequency of beer purchase for household
  • frequency of visiting pubs when drinking beer
  • number of different beer brands respondent buys for household
  • number of different beer brands respondent buys in pubs
  • which beer brands respondent buys

How to use it

The application can be used to aid recruiting focus group participants. The application gives the membership probability for each of the segments. In the application you provide some basic information about new respondent:

  • select the gender and age
  • select the number of brands respondent knows about
  • select the frequency of purchase
  • select the frequency of visiting pubs
  • select the number of brands respondent buys for household
  • select the number of brands respondent buys in pubs
  • you also check which brands respondent buys

How it works

The application gets inputs from the user in the UI and then run server code similar to the code below:

pred.rf.prob <- predict(model.caret, case, type="prob")

The application reads the Random Forest model and predicts to what segment “new” respondent falls based on user input. The application gives the membership probability for each of the segments like in this example:

print(pred.rf.prob)
  Segment A Segment B Segment C Segment D Segment E
2     0.004      0.92     0.008     0.054     0.014

The application

Input part: alt text

Output part: alt text

You can find the application here: https://tonigril.shinyapps.io/rfpred/