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

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
相关推荐
β添砖java7 小时前
机器学习2 KNN算法、距离度量、特征预处理、超参数选择、手写数字、鸢尾花
人工智能·算法·机器学习
cc_瀚海知行7 小时前
模型调用 3|怎样让程序可靠地接收模型输出?
人工智能·ai
科创致远7 小时前
科创致远 ESOP 系统深度评测:从参数解析到 ROI 实战验证
大数据·人工智能·制造·精益工程
CAIE研习社7 小时前
从“会聊天”到能落地:光伏、风电运维里的AI怎么用?
大数据·人工智能
TAN-90°-7 小时前
Deep Learning for Computer Vision——Generative Models 2
人工智能·深度学习·神经网络·算法·目标检测·机器学习·计算机视觉
洞见新研社7 小时前
豆包手机发售,AI代理进入“终端”竞赛
人工智能·ai
QC777LX7 小时前
中文专业在AI行业的新岗位:从Prompt到人文训练
人工智能
知几蜗牛7 小时前
2.8万亿参数上云之后,Kimi K3的门槛变低了吗
人工智能
sarasuki8 小时前
工具设计的坏味道:什么样的定义会让模型乱调
人工智能·agent·设计
jingli98 小时前
微信自动回复怎么设置?重复问题怎么自动回答——私域FAQ自动应答搭建全流程(关键词匹配+知识库+语义AI,2026实操版)
人工智能·自动化·用户运营