概述:
余弦相似度 是对两个向量相似度的描述,表现为两个向量的夹角的余弦值。当方向相同时(调度为0),余弦值为1,标识强相关;当相互垂直时(在线性代数里,两个维度垂直意味着他们相互独立),余弦值为0,标识他们无关。
Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them. The cosine of 0° is 1, and it is less than 1 for any other angle. It is thus a judgement of orientation and not magnitude: two vectors with the same orientation have a Cosine similarity of 1, two vectors at 90° have a similarity of 0, and two vectors diametrically opposed have a similarity of -1, independent of their magnitude. Cosine similarity is particularly used in positive space, where the outcome is neatly bounded in [0,1].

定义
基础知识。。

The cosine of two vectors can be derived by using the Euclidean dot product formula:

Given two vectors of attributes, A and B, the cosine similarity, cos(θ), is represented using a dot product and magnitude as

The resulting similarity ranges from −1 meaning exactly opposite, to 1 meaning exactly the same, with 0 usually indicating independence, and in-between values indicating intermediate similarity or dissimilarity.

与皮尔森相关系数的关系
If the attribute vectors are normalized by subtracting the vector means (e.g., ), the measure is called centered cosine similarity and is equivalent to the Pearson Correlation Coefficient.









spark MLlib 概念 5: 余弦相似度(Cosine similarity)的更多相关文章

  1. 相似度度量:欧氏距离与余弦相似度(Similarity Measurement Euclidean Distance Cosine Similarity)

    在<机器学习---文本特征提取之词袋模型(Machine Learning Text Feature Extraction Bag of Words)>一文中,我们通过计算文本特征向量之间 ...

  2. 余弦相似度-Cosine Similar(转载)

    余弦相似度用向量空间中两个向量夹角的余弦值作为衡量两个个体间差异的大小.相比距离度量,余弦相似度更加注重两个向量在方向上的差异,而非距离或长度上. 与欧几里德距离类似,基于余弦相似度的计算方法也是把用 ...

  3. spark MLlib 概念 4: 协同过滤(CF)

    1. 定义 协同过滤(Collaborative Filtering)有狭义和广义两种意义: 广义协同过滤:对来源不同的数据,根据他们的共同点做过滤处理. Collaborative filterin ...

  4. spark MLlib 概念 6:ALS(Alternating Least Squares) or (ALS-WR)

    Large-scale Parallel Collaborative Filtering for the Netflix Prize http://www.hpl.hp.com/personal/Ro ...

  5. spark MLlib 概念 3: 卡方分布(chi-squared distribution)

    数学定义[编辑] 若k个随机变量.--.是相互独立,符合标准正态分布的随机变量(数学期望为0.方差为1),则随机变量Z的平方和 被称为服从自由度为 k 的卡方分布,记作 Definition[edit ...

  6. spark MLlib 概念 2:Stratified sampling 层次抽样

    定义: In statistical surveys, when subpopulations within an overall population vary, it is advantageou ...

  7. spark MLlib 概念 1:相关系数( PPMCC or PCC or Pearson's r皮尔森相关系数) and Spearman's correlation(史匹曼等级相关系数)

    皮尔森相关系数定义: 协方差与标准差乘积的商. Pearson's correlation coefficient when applied to a population is commonly r ...

  8. Spark MLlib

    MLlib    数据挖掘与机器学习        数据挖掘体系 数据挖掘:也就是data mining,是一个很宽泛的概念,也是一个新兴学科,旨在如何从海量数据中挖掘出有用的信息来.         ...

  9. Sequence Model-week2编程题1-词向量的操作【余弦相似度 词类比 除偏词向量】

    1. 词向量上的操作(Operations on word vectors) 因为词嵌入的训练是非常耗资源的,所以ML从业者通常 都是 选择加载训练好 的 词嵌入(Embedding)数据集.(不用自 ...

随机推荐

  1. springcloud(十一)-Zuul聚合微服务

    前言 我们接着上一节.在许多场景下,外部请求需要查询Zuul后端的多个微服务.比如一个电影售票手机APP,在购票订单页上,既需要查询“电影微服务”获得电影相关信息,又需要查询“用户微服务”获得当前用户 ...

  2. 禁止antd Input.Password浏览器自动回传

    设置autoComplete为new-password

  3. TKmybatis和mybatisplus哪个好用

    文档连接 :http://baomidou.oschina.io/mybatis-plus-doc/#/?id=%E7%AE%80%E4%BB%8B https://gitee.com/hengboy ...

  4. Nginx安装目录详解

    Nginx安装目录详解 1. 查看有关nginx的所有目录列表,输入命令  rpm -ql nginx 可以查看有关nginx目录信息,但是注意 这种命令只能是在基于yum安装的方式才可以. 2. 下 ...

  5. Windows常用快捷键与常用命令

    应用窗口: Alt+F4 关闭当前窗口Win+上 最大化当前窗口Win+下 最小化当前窗口WIN+D 最小化所有窗口/还原Win+Tab 切换窗口 常用工具: Win+R 打开运行对话框Win+E 打 ...

  6. poj 1163 The Triangle(dp)

    The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 43993   Accepted: 26553 De ...

  7. Coinbase 雇员被 Firefox 0day 漏洞攻击

    Firefox 刚刚修复的 0day 漏洞被用于攻击 Coinbase 雇员.Coinbase 安全团队的 Philip Martin 称,攻击者组合利用了两个 0day 漏洞,其一是远程代码执行漏洞 ...

  8. Share:《THE ULTIMATE XSS PROTECTION CHEATSHEET FOR DEVELOPERS》

    Ajin Abraham(OWASP Xenotix XSS Exploit Framework的作者哦!)编写的<THE ULTIMATE XSS PROTECTION CHEATSHEET ...

  9. 变分推断到变分自编码器(VAE)

    EM算法 EM算法是含隐变量图模型的常用参数估计方法,通过迭代的方法来最大化边际似然. 带隐变量的贝叶斯网络 给定N 个训练样本D={x(n)},其对数似然函数为: 通过最大化整个训练集的对数边际似然 ...

  10. C语言高级用法---typeof( ((type *)0)->member )和offset_of()

    前言 本文讲解typeof( ((type *)0)->member )的含义,并在此基础上学习offset_of()的用法.typeof( ((type *)0)->member ) A ...