Mutual Information
Mutal Information, MI, 中文名称:互信息. 用于描述两个概率分布的相似/相关程度. 常用于衡量两个不同聚类算法在同一个数据集的聚类结果的相似性/共享的信息量.
给定两种聚类结果\(X,Y\), 现在用MI来衡量它们之间的相似程度 计算方式为:
\]
其中\(U=set(X), V = set(Y)\)(set()为去重操作).
从概率论的角度来理解, \(\frac{p(u, v)}{p(u)p(v)}\)描述了\(u, v\)之间的相关性: 相关性越大, 值越大(大于1);若独立, 则为1. 从整体来看, \(X, Y\)的distribution pattern越相似, MI越大.
下面是摘自http://www.cnblogs.com/ziqiao/archive/2011/12/13/2286273.html的matlab代码, 可帮助理解.
function MIhat = nmi( A, B ) %NMI Normalized mutual information
% http://en.wikipedia.org/wiki/Mutual_information
% http://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-clustering-1.html
% Author: http://www.cnblogs.com/ziqiao/ [2011/12/13]
if length( A ) ~= length( B)
error('length( A ) must == length( B)');
end
total = length(A);
A_ids = unique(A);
B_ids = unique(B);
% Mutual information
MI = 0;
for idA = A_ids
for idB = B_ids
idAOccur = find( A == idA );
idBOccur = find( B == idB );
idABOccur = intersect(idAOccur,idBOccur);
px = length(idAOccur)/total;
py = length(idBOccur)/total;
pxy = length(idABOccur)/total;
MI = MI + pxy*log2(pxy/(px*py)+eps); % eps : the smallest positive number
end
end
% Normalized Mutual information
Hx = 0; % Entropies
for idA = A_ids
idAOccurCount = length( find( A == idA ) );
Hx = Hx - (idAOccurCount/total) * log2(idAOccurCount/total + eps);
end
Hy = 0; % Entropies
for idB = B_ids
idBOccurCount = length( find( B == idB ) );
Hy = Hy - (idBOccurCount/total) * log2(idBOccurCount/total + eps);
end
MIhat = 2 * MI / (Hx+Hy);
end
% Example :
% (http://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-clustering-1.html)
% A = [1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3];
% B = [1 2 1 1 1 1 1 2 2 2 2 3 1 1 3 3 3];
% nmi(A,B)% ans = 0.3646
Mutual Information的更多相关文章
- 互信息(Mutual Information)
本文根据以下参考资料进行整理: 1.维基百科:https://zh.wikipedia.org/wiki/%E4%BA%92%E4%BF%A1%E6%81%AF 2.新浪博客:http://blog. ...
- Mutual information and Normalized Mutual information 互信息和标准化互信息
实验室最近用到nmi( Normalized Mutual information )评价聚类效果,在网上找了一下这个算法的实现,发现满意的不多. 浙江大学蔡登教授有一个,http://www.zju ...
- 泡泡一分钟:Robust and Fast 3D Scan Alignment Using Mutual Information
Robust and Fast 3D Scan Alignment Using Mutual Information 使用互信息进行稳健快速的三维扫描对准 https://arxiv.org/pdf/ ...
- Computer Vision_33_SIFT:A novel coarse-to-fine scheme for automatic image registration based on SIFT and mutual information——2014
此部分是计算机视觉部分,主要侧重在底层特征提取,视频分析,跟踪,目标检测和识别方面等方面.对于自己不太熟悉的领域比如摄像机标定和立体视觉,仅仅列出上google上引用次数比较多的文献.有一些刚刚出版的 ...
- Image Processing and Analysis_15_Image Registration:Multi-modal volume registration by maximization of mutual information——1996
此主要讨论图像处理与分析.虽然计算机视觉部分的有些内容比如特 征提取等也可以归结到图像分析中来,但鉴于它们与计算机视觉的紧密联系,以 及它们的出处,没有把它们纳入到图像处理与分析中来.同样,这里面也有 ...
- Point-wise Mutual Information
Point-wise Mutual Information (Yao, et al 2019) reclaimed a clear description of Point-wise Mutual I ...
- 双目立体匹配经典算法之Semi-Global Matching(SGM)概述:匹配代价计算之互信息(Mutual Information,MI)
半全局立体匹配算法Semi-Global Matching,SGM由学者Hirschmüller在2005年所提出1,提出的背景是一方面高效率的局部算法由于所基于的局部窗口视差相同的假设在很多情况 ...
- [论文阅读笔记] Adversarial Mutual Information Learning for Network Embedding
[论文阅读笔记] Adversarial Mutual Information Learning for Network Embedding 本文结构 解决问题 主要贡献 算法原理 实验结果 参考文献 ...
- Entropy, relative entropy and mutual information
目录 Entropy Joint Entropy Conditional Entropy Chain rule Mutual Information Relative Entropy Chain Ru ...
随机推荐
- 设置本地上网IP
在局域网中,我们经常需要根据网络连接环境来对本地连接的IP地址进行手动设置,那么如何对IP地址进行设置呢?下面小编就把教程介绍给大家. 1. 右击桌面“网上邻居”->选择“属性”,打开“网络共享 ...
- nginx介绍及相关实验
一.nginx介绍 1.nginx简介 Nginx是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP 服务.Nginx 是由伊戈尔·赛索耶夫为俄罗斯访问量第二的 R ...
- Linux中的零拷贝
零拷贝 本文图片和一些内容均来自后面的参考,非原创只是把文章中的一些关键内容整理一下,算作是一个学习笔记. 传统的I/O操作 传统的IO操作是用户应用程序只是需要调用两个系统调用 read() 和 w ...
- 2019HDU多校第四场题解
1001.AND Minimum Spanning Tree 传送门:HDU6614 题意:给你一个又n个点的完全图,点编号从1~n,每条边的权值为被连接的两点编号按位与后的值.现在要你找到最小生成树 ...
- python字典的遍历
遍历字典: keys() .values() .items() 1. xxx.keys() : 返回字典的所有的key 返回一个序列,序列中保存有字典的所有的键 效果图: 代码: ...
- cogs 1583. [POJ 3237] 树的维护 树链剖分套线段树
1583. [POJ 3237] 树的维护 ★★★★ 输入文件:maintaintree.in 输出文件:maintaintree.out 简单对比时间限制:5 s 内存限制:128 ...
- dp - 循环数组的最大和
首尾相连数组的最大子数组和 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 给定一个由N个整数元素组成的数组arr,数组中有正数也有负数,这个数组不是一般的数组,其首尾是 ...
- 洛谷 p3834 主席树
题目链接:https://www.luogu.org/problem/P3834 主席树求静态区间第k小 #include<iostream> #include<cstdio> ...
- Oracle v_$和v$的解释
以v_$mystat和v$mystat具体说明 grant语句中使用的v_$mystat和test用户访问的v$mystat不一样 这里说一下 v$mystat 和 v_$mystat 的区别 初始状 ...
- dataset中shuffle()、repeat()、batch()用法
import numpy as npimport tensorflow as tfnp.random.seed(0)x = np.random.sample((11,2))# make a datas ...