💚
Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on. You've got this! 🚀
Common AI Mistakes
Understanding common AI mistakes helps you avoid them in your own work and helps you critically evaluate AI systems you encounter.
10 min•By Priygop Team•Updated 2026
The Most Common AI Mistakes
- Overfitting: the model memorizes training data but cannot generalize to new data. Like a student who memorizes textbook answers but cannot solve new exam questions
- Underfitting: the model is too simple and cannot capture the patterns in the data. Like a student who barely studied and guesses on every question
- Data leakage: information from the test set accidentally appears in the training set, causing an unrealistically high score
- Biased data: training data over-represents one group, causing the model to perform poorly on others
- Wrong evaluation metric: measuring accuracy on imbalanced data and concluding the model is great when it is not
- Overpromising: assuming an AI will work perfectly in the real world because it scored well on test data
Overfitting vs. Underfitting Illustrated
Overfitting vs. Underfitting Illustrated
# Illustrating overfitting and underfitting with a simple example
data = [(1, 2), (2, 4), (3, 5), (4, 4), (5, 5)]
# Underfitting: model is too simple
def underfit_model(x):
# Just returns a constant, cannot capture any pattern
return 4
# Good model: captures the general trend
def good_model(x):
# Linear approximation of the pattern
return 1.2 * x + 1.5
# Overfitting: model memorizes each training point exactly
# but will fail on any new point
train_lookup = {x: y for x, y in data}
def overfit_model(x):
# Memorized exact training data - useless for new points
return train_lookup.get(x, "unknown - never seen this input")
print("Comparison of three models:")
print()
print(f"{'Input':>6} {'Actual':>8} {'Underfit':>10} {'Good Model':>12} {'Overfit':>10}")
print("-" * 60)
for x, y_actual in data:
print(f"{x:>6} {y_actual:>8} {underfit_model(x):>10} {good_model(x):>12.1f} {overfit_model(x):>10}")
print()
# Test on new data not in training set
print("New input (x=6) not seen during training:")
print(f" Good model prediction: {good_model(6):.1f}")
print(f" Overfit model prediction: {overfit_model(6)}")Tip
Tip
The goal of machine learning is not to achieve a perfect score on training data. The goal is to generalize well to new, unseen data. A model with 95% accuracy on training data and 60% on testing data is worse than a model with 85% on both. Always check testing data performance.
Diagram
Loading diagram…
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
Key Takeaways
- Understanding common AI mistakes helps you avoid them in your own work and helps you critically evaluate AI systems you encounter.
- Overfitting: the model memorizes training data but cannot generalize to new data. Like a student who memorizes textbook answers but cannot solve new exam questions
- Underfitting: the model is too simple and cannot capture the patterns in the data. Like a student who barely studied and guesses on every question
- Data leakage: information from the test set accidentally appears in the training set, causing an unrealistically high score