Menu

Visualizing the Class Distribution in the Training Set

Visualizing the Class Distribution in the Training Set

After splitting the dataset, we should verify that both the training and testing sets maintain a similar distribution of fake and genuine reviews.

Plot the Training Labels

plt.figure(figsize=(6,4))
sns.countplot(x=y_train)
plt.title("Distribution of Classes in Training Data")
plt.xlabel("Review Type")
plt.ylabel("Count")
plt.show()

Plot the Testing Labels

plt.figure(figsize=(6,4))
sns.countplot(x=y_test)
plt.title("Distribution of Classes in Testing Data")
plt.xlabel("Review Type")
plt.ylabel("Count")
plt.show()

Explanation

The charts should show a similar distribution of fake and genuine reviews in both datasets. This ensures that the model is trained and evaluated on representative data.