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:

  1. Replace the softmax activation at the end of your network with a sigmoid activation
  2. 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网络进行改造以适应多标记数据。

原文地址:https://www.cnblogs.com/ranjiewen/p/9196028.html

时间: 2024-08-01 21:36:03

Multi-label && Multi-label classification的相关文章

/^/m|/$/m|\b|\B|$&|$`|$'|变量捕获|()?|(?:pattern)|(?<LABEL>PATTERN)|$+{LABEL}|(|)|\g{LABEL}

1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 $_=' 7 8 $$ oinn &&& 9 ninq kdownc 10 aninp 11 kkkk'; 12 13 if (/(.*)k\Z/){print "$1\n";}else{print "no match\n";} 14 15 # kkk 16 17 if (/^n(.*)/m){print "$1\n"

android 到底是什么决定了app的名称 application label activity label

原文地址:http://blog.csdn.net/lamp_zy/article/details/7878979 原来博主的博客的名字仅仅是application label表示菜比的我没有搜到,然后复制过来加入几个keyword吧.希望能够帮到很多其它人 activity和application里都能够设置android:label标签.activity的优先级高于application,也就是说两者都设置这个标签的话.activity的值覆盖application application里

android 究竟是什么决定了app的名称 application label activity label

原文地址:http://blog.csdn.net/lamp_zy/article/details/7878979 原来博主的博客的名字只是application label表示菜比的我没有搜到,然后复制过来添加几个关键字吧.希望可以帮到更多人 activity和application里都可以设置android:label标签,activity的优先级高于application,也就是说两者都设置这个标签的话,activity的值覆盖application application里设置了此标签,

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 the file kafka/config/zookeeper.properties server.1=zNode01:2888:3888 server.2=zNode02:2888:3888 server.3=zNode03:2888:3888 #add here more servers if yo

iOS在半透明view上面添加label导致label半透明

如果设置一个view为半透明,那么view上面的子视图也会变成半透明状态,那么我们应该怎么操作,才能使子视图不跟随view改变透明度呢 UIColor *color = [UIColor blackColor]; color = [color colorWithAlphaComponent:0.6]; self.view.backgroundColor = color; 在改变父视图背景颜色的时候,应用上面的方法.这样 再添加子视图的时候,子视图就不会改变透明度了

微信小程序组件解读和分析:十一、label标签

label标签组件说明: label标签,与html的label标签基本一样.label 元素不会向用户呈现任何特殊效果.不过,它为鼠标用户改进了可用性.如果您在 label 元素内点击文本,就会触发此控件.就是说,当用户选择该标签时,就会自动将焦点转到和标签绑定的表单控件上,主要用来改进表单组件的可用性.使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件.for优先级高于内部控件,内部有多个控件的时候默认触发第一个控件.目前可以绑定的控件有:<button/>

jquery点击label触发2次的问题

今天写问卷的时候遇到个label点击的时候,监听的click事件被执行两次:产生这个的原因么...事件冒泡 <div class="questionBox checkBox"> <div class="title"> 2.你如何理解创新意识的重要性?</div> <div class="checkBoxList" data-more="2"> <label> <

NGUI使用1——label

1,创建 Widget 为了显示label,我们需要新建一个Widget.也就是所谓的小工具. 在菜单上点击[NGUI]-->[Create]-->[Widget].之后,Hierarchy面板上,会自动建立出 UI Root,包括(Camera .Container). 2,创建 Label 在层级面板中,点击Container,然后菜单上点击[NGUI]-->[Create]-->[Label].这样,就新建了一个Label. Label 的其他重要参数: ■字体变色: [颜色

第7天:input和label标签

今天学的不多,就只学了表单元素中的input和label标签.搬了房子,收拾了一下东西,太累了,所以没有学很多.明天还上班,今天就先到这. 一.input input标签type属性有以下几个:text.password.textarea.radio.checkbox.button.submit.reset按钮1.<input type="button" value="确定">2.<input type="submit" >

python读取mnist label数据库

<br>[offset] [type] [value] [description] 0000 32 bit integer 0x00000803(2051) magic number 0004 32 bit integer 60000 number of items 0008 unsigned byte ?? label 0009 unsigned byte ?? label ........ xxxx unsigned byte ?? label Mnist label数据结构如上. 完整代