Menu

Understanding the Training and Testing Data

Understanding the Training and Testing Data

After splitting the dataset, it's useful to understand how much data is used for training and testing.

Training data is used to teach the model patterns in the reviews, while testing data is used to measure how well the model generalizes to new, unseen reviews.

Display Dataset Sizes

print(f"Training Samples: {len(y_train)}")
print(f"Testing Samples: {len(y_test)}")

Calculate the Split Percentage

total = len(df)
train_percentage = (len(y_train) / total) * 100
test_percentage = (len(y_test) / total) * 100
print(f"Training Data: {train_percentage:.2f}%")
print(f"Testing Data: {test_percentage:.2f}%")