# Kaggle Titanic Problem

I have two datasets train and test I did all the data cleaning on both the datasets.In my test dataset I don't have the dependant variable while in the train set I have dependent as well as independent variables. So, to make the predictions I am using my y_train which will act as my y_test and test for the independent variables.When I try to get accuracy using the confusion_matrix, I get the following error:

Error: Found input variables with inconsistent numbers of samples: [891, 418]

y_train.shape - (891,)

test.shape - (418, 9)


How do I fix this ? This is my first project and I am a beginner.

You are comparing your training dataset (y_train) with your test dataset (test). These datasets have different lengths (891 vs 418) meaning that you can't compare them 1:1. You need to make sure you select both your features and values to predict from the same split, so either form the training or the test dataset.