This is my code for the train_test_split
from sklearn.model_selection import train_test_split
X_train,X_test, y_train, y_test = train_test_split(X,y, test_size= 0.20, random_state = 40)
print("x_train ",X_train.shape)
print("x_test ",X_test.shape)
print("y_train ",y_train.shape)
print("y_test ",y_test.shape)
x_train (32408, 29)
x_test (8103, 29)
y_train (32408,)
y_test (8103,)
from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(random_state=0, n_estimators=100,\
criterion = 'entropy', max_leaf_nodes=30,n_jobs=-1)
model_RF = classifier.fit(X_train, y_train)
acc_train_rf = round(classifier.score(X_train, y_train),2)*100
print(" Model accuracy within training data is : " + str(acc_train_rf) +"%")
Model accuracy within training data is: 100.0%