zoukankan      html  css  js  c++  java
  • 损失函数

    Loss Function

    Loss function is used to measure the degree of fit. So for machine learning a few elements are:

    1. Hypothesis space: e.g. parametric form of the function such as linear regression, logistic regression, svm, etc.
    2. Measure of fit: loss function, likelihood
    3. Tradeoff between bias vs. variance: regularization. Or bayesian estimator (MAP)
    4. Find a good h in hypothesis space: optimization. convex - global. non-convex - multiple starts
    5. Verification of h: predict on test data. cross validation.

    Among all linear methods y=f(θTx)y=f(θTx), we need to first determine the form of ff, and then finding θθ by formulating it to maximizing likelihood or minimizing loss. This is straightforward.

    For classification, it's easy to see that if we classify correctly we have yf=yθTx>0y⋅f=y⋅θTx>0, and yf=yθTx<0y⋅f=y⋅θTx<0 if incorrectly. Then we formulate following loss functions:

    1. 0/1 loss: minθiL0/1(θTx)minθ∑iL0/1(θTx). We define L0/1(θTx)=1L0/1(θTx)=1 if yf<0y⋅f<0, and =0=0 o.w. Non convex and very hard to optimize.
    2. Hinge loss: approximate 0/1 loss by minθiH(θTx)minθ∑iH(θTx). We define H(θTx)=max(0,1yf)H(θTx)=max(0,1−y⋅f). Apparently HH is small if we classify correctly.
    3. Logistic loss: minθilog(1+exp(yθTx))minθ∑ilog(1+exp⁡(−y⋅θTx)). Refer to my logistic regression notes for details.

    For regression:

    1. Square loss: minθi||y(i)θTx(i)||2minθ∑i||y(i)−θTx(i)||2

    Fortunately, hinge loss, logistic loss and square loss are all convex functions. Convexity ensures global minimum and it's computationally appleaing.

        https://www.kaggle.com/wiki/LogarithmicLoss
  • 相关阅读:
    servlet的监听器、过滤器、拦截器的区别
    根据一个单词找所有的兄弟单词的思想如何处理
    Maven deploy 部署 jar 到 Nexus 私服
    在vps上搭建hexo博客
    Java解决LeetCode72题 Edit Distance
    学以致用:Python爬取廖大Python教程制作pdf
    puppeteer截图
    Netty接收HTTP文件上传及文件下载
    Docker中执行Shell出现乱码
    Netty URL路由方案探讨
  • 原文地址:https://www.cnblogs.com/zhizhan/p/5901613.html
Copyright © 2011-2022 走看看