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

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∑mtestytest(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
相关推荐
环境栈笔记9 分钟前
高性价比指纹浏览器推荐与选型:如何对照价格和实际可用功能筛选候选
前端·人工智能·后端·自动化
OpenCSG10 分钟前
GPT-5.6 深夜正式上线:下一代模型能力升级,AI Agent 进入深度协作时代
人工智能·gpt
Revolution6115 分钟前
Agent 请求失败后,别再疯狂点击重新生成了
人工智能·claude
小宋102118 分钟前
不用学算法也能玩转 AI?普通 Java 程序员转 AI 应用开发路线
java·人工智能·重构
迷茫中的自我28 分钟前
KMP全栈开发:从Android到AI Agent的技术演进与实践
android·人工智能
龍德明宇29 分钟前
Emu3的「阳谋」:当AI不再「看」图,它还剩下什么?-龍德明宇
人工智能·大语言模型llm·负主体性·ai存在论
糖果店的幽灵29 分钟前
WorkBuddy + 好提示词 = 生产力。43 个场景,复制就能用
人工智能·langgraph
硅谷秋水32 分钟前
ABot-M0.5:统一的移动-与-操作世界动作模型
人工智能·深度学习·机器学习·计算机视觉·语言模型·机器人
AI大模型-小华37 分钟前
Codex 为什么越用越慢?大型项目中的上下文管理与方案选择
人工智能·chatgpt·软件开发·codex·开发效率·chatgpt plus·chatgpt pro
D2020202044 分钟前
TikTok达人履约乱象?达秘带你拆解供需权力关系错位的本质
大数据·人工智能