# AV Practice Problem Loan Prediction

#1

I am trying this practice problem. Someone suggested me to use ensemble techniques. How do I use ensemble techniques on a categorical variable? Loan_Status is a categorical variable with only two outcomes ‘Y’ and ‘N’.
Is it possible by giving hypothetical number to ‘Y’ and ‘N’?

#2

@gau2112 - You can make different models like a random forest, boosting and decision tree and create a data frame of each model and use mode function to select a maximum occurring value for each observation from a different model.

``````For example
# adding output of different model to make a single data frame  name as submit_match3
submit_match3\$cuisine2 <- submit_match2\$cuisine
submit_match3\$cuisine1 <- submit_match1\$cuisine

MODE function to extract the predicted value with the highest frequency per id.

#function to find the maximum value row wise
Mode <- function(x) {
u <- unique(x)
u[which.max(tabulate(match(x, u)))]
}
x <- Mode(submit_match3[,c("cuisine","cuisine2","cuisine1")])
y <- apply(submit_match3,1,Mode)
``````

Hope this helps!

Regards,
Hinduja

#3

Thanks a lot.

#4

For Python, use following EnsembleClassifier that combines different models.
Check below URL who developed this module and also explained with examples.

#5

hey.can someone please share the solution in R. If possible please mail.It will be really helpful. TIA!

ankitpaul7@gmail.com