AI/๋จธ์‹ ๋Ÿฌ๋‹

ch2_learning2 ํŽธํ–ฅ-๋ถ„์‚ฐ Bias-variance Trade-off

9taetae9 2024. 4. 16. 20:04
728x90

Bias(ํŽธํ–ฅ) : Gap between the real problem and our model / The expected error created by using a model to apporoximate a real world function/relationship. ๋ชจ๋ธ์„ ํ†ตํ•ด ์–ป์€ ์˜ˆ์ธก๊ฐ’๊ณผ ์‹ค์ œ ์ •๋‹ต๊ณผ์˜ ์ฐจ์ด์˜ ํ‰๊ท 

f hat(x) : predicted value 

f(x) : true value 

 

Variance(๋ถ„์‚ฐ) : change for different training data sets / The amount our predicted values would change if we had a differenct training dataset. It is the "flexibility" of our model, balanced against bias. ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ์…‹์— ๋Œ€ํ•˜์—ฌ ์˜ˆ์ธก๊ฐ’์ด ์–ผ๋งŒํผ ๋ณ€ํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ์ง€์— ๋Œ€ํ•œ ์–‘(Quantity)์˜ ๊ฐœ๋…, ์˜ˆ์ธก๊ฐ’๋“ค์˜ ํŽธ์ฐจ

 

more flexible -> lower bias, higher variance ๋” ๋ณต์žก๋„๊ฐ€ ๋†’์„์ˆ˜๋ก  ํŽธํ–ฅ์€ ์ž‘์•„์ง€๊ณ  ๋ถ„์‚ฐ์€ ์ปค์ง„๋‹ค

 

A more flexible model can adapt more closely to the training datareducing bias but increasing the variance because it becomes sensitive to noise in the data. (possible problem : overfitting)

๋ณต์žก๋„๊ฐ€ ๋†’์€ ๋ชจ๋ธ์€ training data์— ๋Œ€ํ•ด ์ •ํ™•๋„๊ฐ€ ๋†’์ง€๋งŒ 

Conversely, a less flexible model may not capture complex patterns, leading to higher bias but lower variance. (possible problem : underfitting)

 

 

ํ•™์Šต ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ผ ์ˆ˜ ์žˆ๋Š” ์ข‹์€ ์ฒ™๋„๊ฐ€ ๋œ๋‹ค.

 

 

Q) Debugging a learning algorithm 

Suppose you have implemented regularized linear regression to predict housing prices. However, when you test your hypothesis in a new set of houses, you find that it makes unacceptably large errors in its prediction. What should you try next?

 

A1) Evaluate Bias and Variance
High Bias (Underfitting): This is typically indicated if both training error and cross-validation error are high. The model is too simple and fails to capture the underlying trend of the data.
High Variance (Overfitting): This is indicated if the training error is low, but the cross-validation error is high. The model is too complex, capturing noise instead of the underlying pattern.

A2) Strategies Based on Diagnosis

For High Bias
Add more features or create complex features: This can help the model capture more complex patterns in the data, thus reducing bias.
Add polynomial features: Including interaction terms (e.g., x1x2) or polynomial features (e.g., x1^2, x2^2) can make the model more flexible and better at capturing complex patterns.
Decrease λ: Lowering the regularization strength can allow the learning algorithm to fit the data more closely, thus reducing bias but possibly increasing variance.
For High Variance
1) Get more training examplesMore data can help the model generalize betterreducing overfitting.

2) Try smaller sets of features: Reducing the number of features can help by simplifying the model, thus reducing the chance it will capture noise in the training data.
3) Increase λ (regularization strength): Increasing the regularization parameter can penalize large weights in the model, effectively simplifying the model and reducing variance.

A3) Iterative Testing
After implementing a change, re-evaluate the model's performance using a new validation set or through cross-validation. Continue adjusting features, the regularization parameter, and other aspects of the model based on these diagnostic tests until you achieve a satisfactory level of error.

A4) Cross-Validation
Utilize cross-validation to assess how the adjustments are impacting model performance on unseen data. This will guide you in understanding whether adjustments are effectively addressing bias or variance problems.

 

์ฐธ๊ณ  ์ž๋ฃŒ :

https://gaussian37.github.io/machine-learning-concept-bias_and_variance/

 

๋จธ์‹ ๋Ÿฌ๋‹์—์„œ์˜ Bias์™€ Variance

gaussian37's blog

gaussian37.github.io

https://www.rnfc.org/courses/isl/Lesson%202/Summary/

 

Lesson 2 - Statistical Learning · RN Financial Research Centre

โ‡ฆ Back to Resources Lesson 2 - Statistical Learning \[\newcommand{\Var}{\mathrm{Var}} \newcommand{\MSE}{\mathrm{MSE}} \newcommand{\Avg}{\mathrm{Avg}} \newcommand{\Bias}{\mathrm{Bias}}\] What is Statistical Learning? Consider observed response variable \(

www.rnfc.org

https://wikidocs.net/214038

 

2.2.2 ํŽธํ–ฅ-๋ถ„์‚ฐ ํŠธ๋ ˆ์ด๋“œ์˜คํ”„(The Bias-Variance Trade-Off)

(32์ชฝ) Test MSE ๊ณก์„ ์—์„œ ๊ด€์ฐฐ๋˜๋Š” U์ž ํ˜•ํƒœ(๊ทธ๋ฆผ 2.9-2.11)๋Š” ํ†ต๊ณ„ํ•™์Šต ๋ฐฉ๋ฒ•์˜ ๋‘ ๊ฐ€์ง€ ๊ฒฝ์Ÿํ•˜๋Š” ํŠน์„ฑ(two competing properties)์˜ ๊ฒฐ๊ณผ์ด๋‹ค…

wikidocs.net

728x90