Detect Overfitting or Underfitting

Validation & Tuning DS practice problem on Onlearn.

Difficulty: easy.

Topics: Detect Overfitting or Underfitting, Generalization Gap, K-Fold Partitioning, Early Stopping, Weight Decay, Validation Loss Plateau, Statistical Learning Theory, Model Evaluation Metrics, Optimization Algorithms, Regularization Techniques, Data Preprocessing, Bias-Variance Decomposition, Cross-Validation Strategies, Learning Curve Analysis, Hyperparameter Tuning, Model Complexity Control.

Write a Python function to determine whether a machine learning model is overfitting, underfitting, or performing well based on training and test accuracy values. The function should take two inputs: training accuracy and test accuracy. It should return one of three values: 1 if Overfitting, 1 if Underfitting, or 0 if a Good fit. The rules for determination are as follows: Overfitting : The training accuracy is significantly higher than the test accuracy (difference 0.2). Underfitting : Both training and test accuracy are below 0.7. Good fit : Neither of the above conditions is true.