Support Vector Machine

Support Vector Machine

  • A brief review of the logistic regression
  • Modification of the logistic regression to the SVM
  • 图片链接和图片上传
  • LaTex数学公式
  • UML序列图和流程图
  • 离线写博客
  • 导入导出Markdown文件
  • 丰富的快捷键

A brief review of the logistic regression

The classification problem,

Email: Spam / Not Spam,
Online transactions: Fraudulent (Yes/No)?
Tumor:Malignant / Benign?

Problems like y0,1 y ∈ 0 , 1 ,only two classes, called two-class or binary classification problem. Multi-class classification problem would be discussed later.

We use x x to denote the input and y to denote the output, the hypothesis gives a relation by

hθ(x)=11+eθTx, h θ ( x ) = 1 1 + e − θ T x ,

where θ θ is the parameter vector and we also use z z to denote z=θTx. Function g(z)=11+ez g ( z ) = 1 1 + e − z is called the sigmoid function or Logistic function, and
hθ(x)=g(θTx) h θ ( x ) = g ( θ T x )
.
hθ(x) h θ ( x ) can be considered as the probability of y=1 y = 1 .

The cost function of the linear regression is given in the form of

J(θ)=1mi=1m12(hθ(x(i))y(i))2. J ( θ ) = 1 m ∑ i = 1 m 1 2 ( h θ ( x ( i ) ) − y ( i ) ) 2 .

We may use
Cost(hθ(x),y)=12(hθ(x)y)2 Cost ( h θ ( x ) , y ) = 1 2 ( h θ ( x ) − y ) 2

to represent the cost function.

If the logistic regression use the same form of cost function, it will bring a non-convex cost function.

The cost function of the logistic function is

J(θ)={log(1hθ(x)),log(hθ(x)),y=0y=1. J ( θ ) = { − log ⁡ ( 1 − h θ ( x ) ) , y = 0 − log ⁡ ( h θ ( x ) ) , y = 1 .

The all-in-one expression of the cost function is thus

J(θ)=ylog(1hθ(x))(y1)log(hθ(x)). J ( θ ) = − y ⋅ log ⁡ ( 1 − h θ ( x ) ) − ( y − 1 ) ⋅ log ⁡ ( h θ ( x ) ) .






The cost function can be obtained by cross-entropy and maximum-likelihood estimation analysis.

Multi-class classification

(week3, multi-class classification: one-vs-all,)
有些时候我们会遇到有多个class的分类问题,如



画在图上,可以表示为



因为logistic regression只能将样本分为两类,所以不太适合直接套用。常见的一个方法就是one-vs-all(one-vs-rest),就是把问题分解为K(class的个数)个逻辑回归问题。在K个类中选定一个作为1(真,true),将其他K-1类合并归为0(假,false)。然后再进行逻辑回归。对每一个类都这样做一次。



对于每一个回归得到的 h(i)θ(x) h θ ( i ) ( x ) 可以认为是样本x是第 i i 类的可能性(概率)。最后取令hθ(i)(x)最大的 i i 值作为分类结果即可。



one-vs-all

Support Vector Machine

Large Margin Intuition

表格

Markdown Extra 表格语法:

项目 价格
Computer $1600
Phone $12
Pipe $1

可以使用冒号来定义对齐方式:

项目 价格 数量
Computer 1600 元 5
Phone 12 元 12
Pipe 1 元 234

定义列表

Markdown Extra 定义列表语法:
项目1
项目2
定义 A
定义 B
项目3
定义 C

定义 D

定义D内容

代码块

代码块语法遵循标准markdown代码,例如:

@requires_authorization
def somefunc(param1='', param2=0):
    '''A docstring'''
    if param1 > param2: # interesting
        print 'Greater'
    return (param2 - param1 + 1) or None
class SomeClass:
    pass
>>> message = '''interpreter
... prompt'''

脚注

生成一个脚注1.

目录

[TOC]来生成目录:

数学公式

使用MathJax渲染LaTex 数学公式,详见math.stackexchange.com.

  • 行内公式,数学公式为:Γ(n)=(n1)!nN

    • 块级公式:
    • x=b±b24ac2a x = − b ± b 2 − 4 a c 2 a

      更多LaTex语法请参考 这儿.

      UML 图:

      可以渲染序列图:

      Created with Raphaël 2.1.2 张三 张三 李四 李四 嘿,小四儿, 写博客了没? 李四愣了一下,说: 忙得吐血,哪有时间写。

      或者流程图:

      Created with Raphaël 2.1.2 开始 我的操作 确认? 结束 yes no
      • 关于 序列图 语法,参考 这儿,
      • 关于 流程图 语法,参考 这儿.

      离线写博客

      即使用户在没有网络的情况下,也可以通过本编辑器离线写博客(直接在曾经使用过的浏览器中输入write.blog.csdn.net/mdeditor即可。Markdown编辑器使用浏览器离线存储将内容保存在本地。

      用户写博客的过程中,内容实时保存在浏览器缓存中,在用户关闭浏览器或者其它异常情况下,内容不会丢失。用户再次打开浏览器时,会显示上次用户正在编辑的没有发表的内容。

      博客发表后,本地缓存将被删除。 

      用户可以选择 把正在写的博客保存到服务器草稿箱,即使换浏览器或者清除缓存,内容也不会丢失。

      注意:虽然浏览器存储大部分时候都比较可靠,但为了您的数据安全,在联网后,请务必及时发表或者保存到服务器草稿箱

      浏览器兼容

      1. 目前,本编辑器对Chrome浏览器支持最为完整。建议大家使用较新版本的Chrome。
      2. IE9以下不支持
      3. IE9,10,11存在以下问题
        1. 不支持离线功能
        2. IE9不支持文件导入导出
        3. IE10不支持拖拽文件导入


      1. 这里是 脚注内容.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值