Loss_Function_of_Linear_Classifier_and_Optimization
Loss_Function_of_Linear_Classifier_and_Optimization
Multiclass SVM Loss:
Given an example(xi, yi>/sub>) where xi is the image and where yi is the (integer) label, and using the shorthand for the scores vectors: s = f(xi, W), then:
the SVM loss has the form: \(L_i = \sum\limits_{j != y_i} max(0, s_j-s_{y_i}+1)\),
code format:
L_i_vectorized(x, y, W):
scores = W.dot(x)
margins = np.maximun(0, scores - scores[y] + 1)
margins[y] = 0
loss_i = np.sum(margins)
return loss_i
Adding Regularization:
L = \(\frac{1}{N}*\sum\limits_{i = 1}^{N}{\sum\limits_{i != y_i}{max(0, f(x_i; W)_j - f(x_i; W)_{y_i} + 1)}} + \lambda*R(W)\) \((\lambda)\sum\limits_k{\sum\limits_l{W_{k, l}^2}}\)
Benefits in initializing parameters:
x = [1 1 1 1]
W1 = [1 0 0 0]
W2 = [0.25 0.25 0.25 0.25]
Without the regularization item, the dot result will be the same ones, while actually W2 is better than W1 as common sense. If the regularization item is added into it, the result won't be the same, so we can classify them.
Other Regularization Methods: Elastic net(L1+L2), Max norm regularization, Dropout.
Softmax Classifier (Multinomial Logistic Regression):
Loss_Function_of_Linear_Classifier_and_Optimization的更多相关文章
随机推荐
- 前端PDF文件转图片方法
第一步:先下载pdfjs,网址:PDF下载地址,再引入到项目中,我是标签直接引用的 <script src="pdfjs/build/pdf.js"></scri ...
- ftp上传文件出现553 Could not creat files 严重文件传输错误
之前上传文件到云服务器上一直出错,发现可以下载但是不能上传和编辑,后来终于找到原因了,是因为上传文件所在文件夹默认只有root用户才有写权限,所以我们还要将写权限赋予给其他用户.可以用Xshell 5 ...
- 浅析Linux启动流程
Linux系统启动流程 Linux 系统的启动,从计算机开机通电自检开始,一直到登陆系统,需要经历多个过程.了解 Linux 的启动过程,有助于了解 Linux 系统的结构,也对系统的排错有很大的帮助 ...
- 让绝对定位的div居中
最近看到一个问题就是让绝对定位的div居中,在尝试了top:50%:left:50%:后发现,居中是有问题的并不是想象中的样子 需要再加两句margin-top:-盒子高度的一般px margin- ...
- Azure DevOps Pipelines执行RobotFramework自动化代码
一.Azure DevOps介绍 1.什么是 Azure DevOps? Azure DevOps其实是VSTS(Visual Studio Team Service)更名后的名字.而VSTS是TFS ...
- Golang简易版 网站路径扫描demo
package main import ( "bufio" "fmt" "net/http" "os" "re ...
- 采用pandas读取文件,进行自动化统计小程序
自己完成的第二个自动化统计小程序,完成之后感觉:命名不够规范,造成可读性比较没那么好,幸好给自己很多地方都加了注释#coding:utf-8import os,sysimport reimport x ...
- Java——单例模式、多线程
单例模式 单例模式练习 单例模式的分类 懒汉式 懒汉式相关练习 饿汉式 饿汉式相关练习 线程安全 使用双重检测机制实现线程安全的懒汉式 使用静态内部类实现线程安全的单例模式 多线程 多线程的三种方式 ...
- Go语言学习笔记(2)——零散的话题(反射)
这部分是<Go语言编程>这本书的第9章的内容.书中给该章节的定位是一个文章集,其包含了一些Go语言中比较少涉及,或是比较深入的讨论的内容.因为第一节就是反射,而反射在我看来是比较重要的内容 ...
- python模块----optparse模块、argparse模块 (命令行解析模块)
简介 optparse module---自版本3.2以来已弃用:optparse模块已弃用,将不再进一步开发:将继续使用argparse模块进行开发.optparse使用一种更具声明性的命令行解析方 ...