Machine Learning Course 4 Selection of Model

本课程讨论了机器学习中模型选择的重要性。平均误差在测试数据上的表现分为由偏差和方差引起的两种错误。偏差表示模型的简化程度,而方差反映了模型对训练数据的敏感性。过拟合和欠拟合是模型诊断的关键问题,可以通过增加特征、使用更复杂模型或正则化来调整偏差。模型选择的目标是找到平衡偏差和方差的模型,交叉验证是实现这一目标的有效手段。
摘要由CSDN通过智能技术生成

Course 4

Average Error on testing data

Two main errors:

Error due to bias
Error due to variance

Estimator

Only god knows about the best function
f ^ \hat f f^
and we can only get a function from training data called
f ∗ f^* f
we say:
f ∗ i s a n e s t i m a t o r o f f ^ f^*\quad is\quad an\quad estimator \quad of\quad \hat f fisanestimatoroff^
and the difference between f* and fhat comes from bias and variance

Bias and Variance of Estimator

Suppose the mean of a variable is μ, and the variance of x is σ2
S a m p l e N p o i n t s : { x 1 , x 2 , . . . , x 3 } Sample \quad N \quad points:\{x^1,x^2,...,x^3\} SampleNpoints:{x1,x2,...,x3}

m = 1 N ∑ n x n ≠ μ s 2 = 1 N ∑ n ( x n − m ) 2 m=\frac{1}{N}\sum_n x^n\neq\mu \quad s^2=\frac 1 N \sum_n (x^n-m)^2 m=N1nxn=μs2=N1n(xnm)2

E [ m ] = E [ 1 N ∑ n x n ] = 1 N ∑ n E [ x n ] = μ E [ s 2 ] = N − 1 N σ 2 E[m]=E[\frac{1}{N}\sum_n x^n]=\frac 1 N \sum_n E[x^n]=\mu\quad E[s^2]=\frac{N-1}N \sigma ^2 E[m]=E[N1nxn]=N1nE[xn]=μE[s2]=NN1σ2

m is a biased estimator of μ, s2 is a biased estimator of σ2
V a r [ m ] = σ 2 N Var[m]=\frac{\sigma^2}{N} Var[m]=Nσ2
which shows how much m deviates μ and the variance depends on the amount of sample

and the relationship of these parameters is below:
在这里插入图片描述

Simple model with small variance, and complicated model with large variance since simpler model is less likely to be influenced by the sampled data.
在这里插入图片描述

Diagnosis

  • If your model cannot even fit the training data, then you got a large bias, it is Underfitting
  • If you can fit training data but got large error on testing data, then you probably got a large variance, it is Overfitting

For bias, redesign your model:

  • Add more features as input
  • A more complex model maybe needed

For large variance:

  • More data is needed(Very effective but not always practical)
  • Regularization

Model Selection

There is usually a trade-off between bias and variance

Select a model that balances two kinds of error to minimize total error

Cross Validation could a possible way to make balance:
在这里插入图片描述

And an advanced method called N-fold Cross Validation can be used

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值