机器学习(六) — 评估模型

Evaluate model

1 test set

  1. split the training set into training set and a test set
  2. the test set is used to evaluate the model

1. linear regression

compute test error

J t e s t ( w ⃗ , b ) = 1 2 m t e s t ∑ i = 1 m t e s t [ ( f ( x t e s t ( i ) ) − y t e s t ( i ) ) 2 ] J_{test}(\vec w, b) = \frac{1}{2m_{test}}\sum_{i=1}^{m_{test}} \left [ (f(x_{test}^{(i)}) - y_{test}^{(i)})^2 \right ] Jtest(w ,b)=2mtest1i=1∑mtest[(f(xtest(i))−ytest(i))2]

2. classification regression

compute test error

J t e s t ( w ⃗ , b ) = − 1 m t e s t ∑ i = 1 m t e s t [ y t e s t ( i ) l o g ( f ( x t e s t ( i ) ) ) + ( 1 − y t e s t ( i ) ) l o g ( 1 − f ( x t e s t ( i ) ) ] J_{test}(\vec w, b) = -\frac{1}{m_{test}}\sum_{i=1}^{m_{test}} \left [ y_{test}^{(i)}log(f(x_{test}^{(i)})) + (1 - y_{test}^{(i)})log(1 - f(x_{test}^{(i)}) \right ] Jtest(w ,b)=−mtest1i=1∑mtest[ytest(i)log(f(xtest(i)))+(1−ytest(i))log(1−f(xtest(i))]

2 cross-validation set

  1. split the training set into training set, cross-validation set and test set
  2. the cross-validation set is used to automatically choose the better model, and the test set is used to evaluate the model that chosed

3 bias and variance

  1. high bias: J t r a i n J_{train} Jtrain and J c v J_{cv} Jcv is both high
  2. high variance: J t r a i n J_{train} Jtrain is low, but J c v J_{cv} Jcv is high
  1. if high bias: get more training set is helpless
  2. if high variance: get more training set is helpful

4 regularization

  1. if λ \lambda λ is too small, it will lead to overfitting(high variance)
  2. if λ \lambda λ is too large, it will lead to underfitting(high bias)

5 method

  1. fix high variance:
    • get more training set
    • try smaller set of features
    • reduce some of the higher-order terms
    • increase λ \lambda λ
  2. fix high bias:
    • get more addtional features
    • add polynomial features
    • decrease λ \lambda λ

6 neural network and bias variance

  1. a bigger network means a more complex model, so it will solve the high bias
  2. more data is helpful to solve high variance
  1. it turns out that a bigger(may be overfitting) and well regularized neural network is better than a small neural network
相关推荐
赵侃侃爱分享几秒前
AI漫剧0基础怎么才能学好!长沙有哪几家比较好的机构
人工智能
qcx232 分钟前
【AI Daily】每日Arxiv论文研读Top5-2026-05-16
人工智能·学习·ai·agent·aris
狒狒热知识6 分钟前
全媒体资源整合赋能企业增长2026软文营销平台合作与实施指南
人工智能
互联科技报7 分钟前
物一码防伪技术如何工作?从编码生成到区块链存证的全链路解析
人工智能
深度学习机器9 分钟前
从RAG到LLM Wiki:用AI构建持续进化的个人知识库
人工智能·llm·agent
谷公子的藏经阁10 分钟前
XPU们的未来猜测
人工智能·ai·cpu·npu·技术演进
塔能物联运维12 分钟前
存量机房低成本改造:塔能两相液冷实现投入与效益双赢
大数据·数据库·人工智能
shadowcz00713 分钟前
苹果不卷AI了:iOS 27要让第三方模型“竞标“进系统
人工智能·ios
JSMSEMI1115 分钟前
JSM13N50F 500V N 沟道功率 MOSFET
大数据·网络·人工智能
树獭非懒17 分钟前
AI大模型小白手册 | Function Calling-大模型与真实世界交互的桥梁
人工智能·llm·ai编程