Machine Learning Project on Imbalanced Data


I was going through the article in which the project on imbalanced data was give. However I got stuck in the part where the xgboost technique is to be applied for top 20 features.
Here is the code where I got stuck.

xgb_confused <- confusionMatrix($income_level,xgb_prediction)
Error in confusionMatrix.default($income_level, xgb_prediction) :
The data must contain some levels that overlap the reference.


Hi @nishanthballal.9

From next time, I would suggest you to share your reproducible code also.
As of now, there isn’t enough information for me to resolve this problem.

However, let me try:
According to the error statement, this error says 'the xgb prediction isn’t in 0/1 format, whereas$income_level is in 0/1 format. Check your predict.type prediction parameter. It should be set to response which creating the learner.


#3 (3.5 KB)
Hi @Manish
I have attached the code. The problem could not be solved. Kindly check the code.
It is showing an error in the 280th line. I’m unable to create a confusion matrix for the filtered data.


Could you please check the code and respond?