ES 相似度算法设置(续)
Tuning BM25
One of the nice features of BM25 is that, unlike TF/IDF, it has two parameters that allow it to be tuned:
k1- This parameter controls how quickly an increase in term frequency results in term-frequency saturation. The default value is
1.2. Lower values result in quicker saturation, and higher values in slower saturation. b- This parameter controls how much effect field-length normalization should have. A value of
0.0disables normalization completely, and a value of1.0normalizes fully. The default is0.75.
The practicalities of tuning BM25 are another matter. The default values for k1 and b should be suitable for most document collections, but the optimal values really depend on the collection. Finding good values for your collection is a matter of adjusting, checking, and adjusting again.
The similarity algorithm can be set on a per-field basis. It’s just a matter of specifying the chosen algorithm in the field’s mapping:
PUT /my_index
{
"mappings": {
"doc": {
"properties": {
"title": {
"type": "string",
"similarity": "BM25"
![]()
},
"body": {
"type": "string",
"similarity": "default"
![]()
}
}
}
}
|
|
The |
|
|
The |
Currently, it is not possible to change the similarity mapping for an existing field. You would need to reindex your data in order to do that.
Configuring BM25
Configuring a similarity is much like configuring an analyzer. Custom similarities can be specified when creating an index. For instance:
PUT /my_index
{
"settings": {
"similarity": {
"my_bm25": {
![]()
"type": "BM25",
"b": 0
![]()
}
}
},
"mappings": {
"doc": {
"properties": {
"title": {
"type": "string",
"similarity": "my_bm25"
![]()
},
"body": {
"type": "string",
"similarity": "BM25"
![]()
}
}
}
}
} 参考:https://www.elastic.co/guide/en/elasticsearch/guide/current/changing-similarities.html
ES 相似度算法设置(续)的更多相关文章
- ES BM25 TF-IDF相似度算法设置——
Pluggable Similarity Algorithms Before we move on from relevance and scoring, we will finish this ch ...
- 文本相似度算法——空间向量模型的余弦算法和TF-IDF
1.信息检索中的重要发明TF-IDF TF-IDF是一种统计方法,TF-IDF的主要思想是,如果某个词或短语在一篇文章中出现的频率TF高,并且在其他文章中很少出现,则认为此词或者短语具有很好的类别区分 ...
- 文本相似度 余弦值相似度算法 VS L氏编辑距离(动态规划)
设置n为字符串s的长度.("我是个小仙女") 设置m为字符串t的长度.("我不是个小仙女") 如果n等于0,返回m并退出.如果m等于0,返回n并退出.构造两个向 ...
- python结巴分词余弦相似度算法实现
过余弦相似度算法计算两个字符串之间的相关度,来对关键词进行归类.重写标题.文章伪原创等功能, 让你目瞪口呆.以下案例使用的母词文件均为txt文件,两种格式:一种内容是纯关键词的txt,每行一个关键词就 ...
- Spark/Scala实现推荐系统中的相似度算法(欧几里得距离、皮尔逊相关系数、余弦相似度:附实现代码)
在推荐系统中,协同过滤算法是应用较多的,具体又主要划分为基于用户和基于物品的协同过滤算法,核心点就是基于"一个人"或"一件物品",根据这个人或物品所具有的属性, ...
- elasticsearch算法之词项相似度算法(一)
一.词项相似度 elasticsearch支持拼写纠错,其建议词的获取就需要进行词项相似度的计算:今天我们来通过不同的距离算法来学习一下词项相似度算法: 二.数据准备 计算词项相似度,就需要首先将词项 ...
- ES设置查询的相似度算法
similarity Elasticsearch allows you to configure a scoring algorithm or similarity per field. The si ...
- Java 比较两个字符串的相似度算法(Levenshtein Distance)
转载自: https://blog.csdn.net/JavaReact/article/details/82144732 算法简介: Levenshtein Distance,又称编辑距离,指的是两 ...
- 百度面试题 字符串相似度 算法 similar_text 和页面相似度算法
在百度的面试,简直就是花样求虐. 首先在面试官看简历的期间,除了一个自己定义字符串相似度,并且写出求相似度的算法. ...这个确实没听说过,php的similar_text函数也是闻所未闻的.之前看s ...
随机推荐
- C#按指定长度分割字符串
C#按指定长度分割字符串 这几天学习分析声音的波形数据,接收到的是十六进制的数据,需要将数据转换成十进制再绘图,这个过程涉及到字符串的分割,正好可以促进自己对C#相关知识的学习.说到分割字符串,我 ...
- 在Linux里环境变量设置的方法(export PATH)
一般来说,配置交叉编译工具链的时候须要指定编译工具的路径,此时就须要环境变量设置.比如我的mips-linux-gcc编译器在"/opt/au1200_rm/build_tools/bin& ...
- Java多线程下载文件
package com.test.download; import java.io.File; import java.io.InputStream; import java.io.RandomA ...
- 完好用户体验: 活用window.location与window.open解决页面跳转问题
原文地址: JavaScript Redirects and window.open原文日期: 2014年08月27日翻译日期: 2014年08月31日翻译人员: 铁锚 (译者注: 本文解决的是按 C ...
- hibernate3中session.get()与session.load()两个方法的区别?
1.发送sql的时机不同:load采用延迟加载技术,只有当真正去使用所查处的对象时,才会发送sql:get采用的是立即检索技术,当执行到get方法是就会立即发送sql. 2.返回的对象不同:load返 ...
- rpm包查看和解压(转)
From:http://www.51testing.com/html/57/28557-205195.html 查看rpm包内容: rpm -qpl *.rpm 解压rpm包: rpm2cpio *. ...
- Python常用变量处理手记(拼接数字,转json)
1.拼接字符串和数字时,应先把数字做转换 如,bytes(page) 再做拼接:str+page 或者 s = 'abc' print s + str(1) #abc1 使用list和tuple 参考 ...
- cf-341C Iahub and Permutations
C. Iahub and Permutations time limit per test 1 second memory limit per test 256 megabytes input sta ...
- Vue知识随记
数据绑定内支持JavaScript表达式:string字符串反转用.隔开 js: msg:'Hello ' html: {{ msg.split('').reverse().join('.') }} ...
- 九度OJ 1179:阶乘 (循环)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5149 解决:1523 题目描述: 输入n, 求y1=1!+3!+...m!(m是小于等于n的最大奇数) y2=2!+4!+...p!(p是 ...