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

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
相关推荐
阿杰学AI2 分钟前
AI核心知识135—大语言模型之 OpenClaw(简洁且通俗易懂版)
人工智能·ai·语言模型·自然语言处理·aigc·ai编程·openclaw
薛定e的猫咪6 分钟前
多智能体强化学习求解 FJSP 变体全景:动态调度、AGV 运输、绿色制造与开源代码导航
人工智能·学习·性能优化·制造
机器之心6 分钟前
DeepSeek V4 双版本正式上线!
人工智能·openai
机器之心12 分钟前
机器人马拉松超越人类之后:本体走到尽头,智能成为下半场
人工智能·openai
可观测性用观测云13 分钟前
观测云 Obsy AI Copilot:带上你的 AI 副驾,进入你的观测现场
人工智能
小明的IT世界19 分钟前
Agent系列3:改变你做 AI Agent 的方式
人工智能
AI科技摆渡26 分钟前
三步极速对接 Grok-Video-3 视频生成 API
人工智能·音视频
是大强33 分钟前
NCNN简介
人工智能
数字游民952735 分钟前
gpt image 2怎么用?3个案例+使用方法
人工智能·ai·数字游民9527
minhuan41 分钟前
大模型反向优化传统算法:用大模型学习传统算法的缺陷,反向迭代算法逻辑.152
人工智能·大模型算法应用·大模型反向优化传统算法·算法优化方案