LeetCampus
Interview Question

How would you determine if a machine learning model is overfitting or underfitting during training?

Sample Answers

Example 1: College Project - Analyzing Data Trends

In my final year project, I worked on a data analysis project using a dataset to predict student performance based on various factors. To ensure my model wasn't overfitting or underfitting, I divided the data into training and validation sets. After training the model, I monitored the training and validation loss. If the training loss decreased while the validation loss increased, it indicated overfitting. Conversely, if both losses were high, it suggested underfitting. I adjusted my model complexity and added regularization techniques to improve its performance, ultimately achieving better validation results.

Example 2: Internship Experience - Enhancing Model Accuracy

During my internship, I assisted in developing a machine learning model for customer segmentation. I used cross-validation to evaluate the model's performance. By plotting learning curves, I observed the training and validation accuracy. If the training accuracy was significantly higher than validation accuracy, it indicated overfitting. To combat this, I experimented with different algorithms and reduced model complexity. This practice not only improved model generalization but also taught me the importance of using proper evaluation techniques to ensure reliable predictions.

Example 3: First Job Experience - Model Evaluation Techniques

In my first job as a data analyst, I worked on a predictive model for sales forecasting. I regularly monitored model performance through metrics like RMSE and R-squared. When I noticed that the model performed well on the training data but poorly on the test set, I recognized the signs of overfitting. I implemented techniques like dropout regularization and adjusted hyperparameters. This hands-on experience reinforced my understanding of the importance of evaluating models effectively to avoid common pitfalls like overfitting and underfitting, ensuring that I could deliver accurate forecasts.

Why Interviewers Ask This Question

** Interviewers look for knowledge of concepts like training and validation datasets, loss functions, and various metrics that indicate a model's ability to generalize beyond its training data. A common misconception is that overfitting and underfitting are solely about accuracy; however, they relate more to the model's behavior on unseen data. Real-world applications include optimizing models for better predictions in tasks like image recognition or predictive analytics, where identifying the right balance between bias (underfitting) and variance (overfitting) is crucial.

, accuracy, precision, recall) to demonstrate their competency in diagnosing model performance issues and making improvements.

Keywords

machine learningoverfittingunderfittingmodel evaluationtraining vs validation
November 25, 2026
0 views
Difficulty: Medium
Popularity: Moderate
Share on

Ready to practice more questions?

Explore our collection of technical interview questions from top companies.

View All Questions