1
$\begingroup$

I have customer data for around 400,000 customers where 270,000 of them are current customers and 130,000 of them are past customers who churned, what I am doing is classifying them as 0 (non-churn) and 1 (churner) to come up with probabilities for likelihood of churning. I am using random forests in R.

What I want to know is can I use the full training set (splitting 80/20 for train and test sets) then use the entire current customer list to output the probabilities or will using the same data as the training/testing data affect the final output?

Should I instead take a sample of current and past customers and not include that in the final output of the model? I need to use some current customer data to train the model but can I still use that same data to output the churn risk?

$\endgroup$
0
$\begingroup$

The function predict.randomForest without a newdata parameter actually returns out-of-bag predictions. Essentially for this case this means that each prediction for each customer is built on the set of trees that did not draw that customer in its bootstrapped sample. You can find more information can at Breiman and Cutler's website regarding random forests.

I'm not sure what your data look like, but a sample of code could go as follows:

rf <- randomForest(y ~ ., data = dt, keep.forest = T) pred <- predict(rf)

$\endgroup$
0
$\begingroup$

"what I am doing is classifying them as 0 (non-churn) and 1 (churner) to come up with probabilities for likelihood of churning"

Assuming you are modelling your response as 'ChurnStatus', you can use createDataPartition() in the caret package to create stratified training/test data sets containing equal proportions of 'Churned' and 'NotChurned':

train = createDataPartition(data$ChurnStatus, p=0.8, list=FALSE)
traindata <- data[train,]
testdata <- data[-train,]

The value of 0.80 gives an 80/20 training/test split.

I wouldn't use training data to output the churn risk. Use the held back test data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.