Multi-label && Multi-label classification
In today’s blog post you learned how to perform multi-label classification with Keras.
Performing multi-label classification with Keras is straightforward and includes two primary steps:
- Replace the softmax activation at the end of your network with a sigmoid activation
- Swap out categorical cross-entropy for binary cross-entropy for your loss function
From there you can train your network as you normally would.
The end result of applying the process above is a multi-class classifier.
You can use your Keras multi-class classifier to predict multiple labels with just a singleforward pass.
However, there is a difficulty you need to consider:
You need training data for each combination of categories you would like to predict.
Just like a neural network cannot predict classes it was never trained on, your neural network cannot predict multiple class labels for combinations it has never seen. The reason for this behavior is due to activations of neurons inside the network.
If your network is trained on examples of both (1) black pants and (2) red shirts and now you want to predict “red pants” (where there are no “red pants” images in your dataset), the neurons responsible for detecting “red” and “pants” will fire, but since the network has never seen this combination of data/activations before once they reach the fully-connected layers, your output predictions will very likely be incorrect (i.e., you may encounter “red” or “pants”but very unlikely both).
Again, your network cannot correctly make predictions on data it was never trained on(and you shouldn’t expect it to either). Keep this caveat in mind when training your own Keras networks for multi-label classification.
多类分类(multiclass classification)学习的分类器旨在对一个新的实例指定唯一的分类类别,常用的策略有两类:基于后验概率或距离一次给出所有类别的度量,选择度量值最大的类别作为预测类别;将多类分类分解为许多二元分类问题,然后组合所有二元分类的结果。
多标签分类(multilabel classification)分类器给一个新的实例指定多个类别。这个分类模型有很广泛的实际应用,如:一个文档可能同时属于多个分类;一个蛋白质可能具有多个功能。并且,多个标签之间可能存在一定的依赖或约束关系,如蛋白质的所有功能组成的Go(gene ontology)。这个依赖或约束关系具有层次特性,经常可以描述为树或有向无环图结构,机器学习社团称之为层次多标签分类。由于模型的输出具有层次结构,因此层次多标签分类又属于另外一个近来非常活跃的研究领域:结构预测。层次多标签分类和结构预测都是崭新的、富有挑战性的研究领域。
使用scikit-learn实现多类别及多标签分类算法 。多标签分类格式
:对于多标签分类问题而言,一个样本可能同时属于多个类别。如一个新闻属于多个话题。这种情况下,因变量yy需要使用一个矩阵表达出来。而多类别分类指的是y的可能取值大于2,但是y所属类别是唯一的。它与多标签分类问题是有严格区别的。所有的scikit-learn分类器都是默认支持多类别分类的。但是,当你需要自己修改算法的时候,也是可以使用scikit-learn实现多类别分类的前期数据准备的。多类别或多标签分类问题,有两种构建分类器的策略:One-vs-All及One-vs-One。
多类分类(Multiclass Classification)
一个样本属于且只属于多个类中的一个,一个样本只能属于一个类,不同类之间是互斥的。
典型方法:
One-vs-All or One-vs.-rest:
将多类问题分成N个二类分类问题,训练N个二类分类器,对第i个类来说,所有属于第i个类的样本为正(positive)样本,其他样本为负(negative)样本,每个二类分类器将属于i类的样本从其他类中分离出来。
one-vs-one or All-vs-All:
训练出N(N-1)个二类分类器,每个分类器区分一对类(i,j)。
多标签分类(multilabel classification)
又称,多标签学习、多标记学习,不同于多类分类,一个样本可以属于多个类别(或标签),不同类之间是有关联的。
典型方法
问题转换方法
问题转换方法的核心是“改造样本数据使其适应现有学习算法”。该类方法的思路是通过处理多标记训练样本,使其适应现有的学习算法,也就是将多标记学习问题转换为现有的学习问题进行求解。
代表性学习算法有一阶方法Binary Relevance,该方法将多标记学习问题转化为“二类分类( binary classification )”问题求解;二阶方法Calibrated Label Ranking,该方法将多标记学习问题转化为“标记排序( labelranking )问题求解;高阶方法Random k-labelset,该方法将多标记学习问题转化为“多类分类(Multiclass classification)”问题求解。
算法适应方法
算法适应方法的核心是“改造现有的单标记学习算法使其适应多标记数据”。该类方法的基本思想是通过对传统的机器学习方法的改进,使其能够解决多标记问题。
代表性学习算法有一阶方法ML-kNN},该方法将“惰性学习(lazy learning )”算法k近邻进行改造以适应多标记数据;二阶方法Rank-SVM,该方法将“核学习(kernel learning )”算法SVM进行改造以适应多标记数据;高阶方法LEAD,该方法将“贝叶斯学习(Bayes learning)算法”Bayes网络进行改造以适应多标记数据。
几种分类问题的区别:多类分类,多标签分类,多示例学习,多任务学习
多标签分类(multilabel classification )
- 相关比赛:Multi-label classification of printed media articles to topics(kaggle),阿里天池的fashionAI服饰属性标签分类;查看相关paper
Multi-label && Multi-label classification的更多相关文章
- kubernetes进阶之四:Label和Label Selector
一:什么是Label Label是Kubernetes系列中另外一个核心概念.是一组绑定到K8s资源对象上的key/value对.同一个对象的labels属性的key必须唯一.label可以附加到各种 ...
- k8s中label和label selector的基本概念及使用方法
1.概述 在k8s中,有一个非常核心的概念,就是label(标签),以及对label的使用,label selector. 本文档中,我们就来看看:1.什么是标签,2.如何定义标签,3.什么是标签选择 ...
- How to set an Apache Kafka multi node – multi broker cluster【z】
Set a multi node Apache ZooKeeper cluster On every node of the cluster add the following lines to th ...
- /^/m|/$/m|\b|\B|$&|$`|$'|变量捕获|()?|(?:pattern)|(?<LABEL>PATTERN)|$+{LABEL}|(|)|\g{LABEL}
#!/usr/bin/perl use strict; use warnings; $_=' $$ oinn &&& ninq kdownc aninp kkkk'; if ( ...
- android 到底是什么决定了app的名称 application label activity label
原文地址:http://blog.csdn.net/lamp_zy/article/details/7878979 原来博主的博客的名字仅仅是application label表示菜比的我没有搜到,然 ...
- am335x using brctl iptables dhcpcd make multi wan & multi lan network(十五)
构建多LAN口多WAN口动态网络 [目的] 在AM335X定制动态网络功能,如下所示,在系统当中有两个以太网口,有4G模块,有wifi芯片8188eu支持AP+STA功能. [实验环境] 1. Ub ...
- js操作label,给label赋值,和取label的值
取值:var Label_text=document.getElementById('test_label').innerHTML; 赋值:document.getElementById('test_ ...
- Magento给产品添加“new”或者折扣数量标签 magento new label. discount label
文章最底部有效果图. 给新产品添加“new”的标签.给折扣产品,显示出折扣的数量. 这个可以自己写一段代码加在到模板文件夹下面的catalog/product/list.phtml中. 以下是代码 & ...
- go break label goto label contiue lable
func main() { var i int fmt.Scanf("%d", &i) fmt.Println(i) if i%3 == 0 { goto LABLE1 } ...
- python multi process multi thread
muti thread: python threading: https://docs.python.org/2/library/threading.html#thread-objects https ...
随机推荐
- Adobe PS CS6安装详解
Adobe PS CS6安装破解详解 注:电脑上是否拥有虚拟光驱,若是没有,推荐2345好压:官网http://haozip.2345.com/下载地址:http://dl.2345.com/haoz ...
- Java工具类- 跨域工具类
原本Spring MVC项目添加跨域: 在web.xml文件中配置: <!-- cors解决跨域访问问题 --> <filter> <filter-name>cor ...
- Python 编程:从入门到实战 读书笔记
1..title() 每个单词首字母大写 .upper() 所有字母大写 .lower() 所有字母小写 2. \t 空白 转义字符只能用在""内 ...
- Redis 服务器命令
1.BGREWRITEAOF 异步执行一个 AOF(AppendOnly File) 文件重写操作 2.BGSAVE 在后台异步保存当前数据库的数据到磁盘 3.CLIENT KILL [ip:port ...
- AtCoder Grand Contest 019 F-yes or no
AtCoder Grand Contest 019 F-yes or no 解题思路: 考虑一个贪心策略,假设当前还有 \(x\) 道 \(\text{yes}\) 和 \(y\) 道 \(\text ...
- SQL SERVER 2008 多边形问题的解决
报错内容: 在执行用户定义例程或聚合 "geometry" 期间出现 .NET Framework 错误: System.ArgumentException: 24144: 由于该 ...
- js的继承实现方式
1. 使用call或者apply来实现js对象继承 function Animal(age){ this.age = age; this.say = function(){ console.log(' ...
- ZOJ 2969 Easy Task
E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...
- opencv hog算子
梯度直方图特征(HOG) 是一种对图像局部重叠区域的密集型描述符, 它通过计算局部区域的梯度方向直方图来构成特征.Hog特征结合SVM分类器已经被广泛应用于图像识别中,尤其在行人检测中获得了极大的成功 ...
- 小程序获取openid unionid session_key
.wxml <button bindtap="paytap">授权</button> .js Page({ paytap: function () { va ...