simhash
2024-10-18 18:17:53
1,SimHash
https://yanyiwu.com/work/2014/01/30/simhash-shi-xian-xiang-jie.html
64位Hash为什么海明距离选3?
http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/33026.pdf
上链接右上precision-recall 曲线图,3是最平衡点,即不会错判太多重复,也不会漏掉很多。
SimHash第一步需抽关键词(feature),并有权重(weight,这个一般是基于统计的?没有词库的默认就用1了)
Feature算法,选 slide windows方法,golang代码如下:
func (t *OverlappingStringTokeniser) Tokenise(input string) []string {
var chunks []string
inputLen := len(input)
for position := 0; position < inputLen-int(t.chunkSize); position += int(t.chunkSize - t.overlapSize) {
chunks = append(chunks, input[position:position+int(t.chunkSize)])
}
return chunks
}
1)简单
2)不比其实算法效果差
计算海明距离:
// Compare calculates the Hamming distance between two 64-bit integers
//
// Currently, this is calculated using the Kernighan method [1]. Other methods
// exist which may be more efficient and are worth exploring at some point
//
// [1] http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
func Compare(a uint64, b uint64) uint8 {
v := a ^ b
var c uint8
for c = 0; v != 0; c++ {
v &= v - 1
}
return c
}
最新文章
- 获得ip地理信息的几种方法
- nmon工具的安装及简单使用
- MySQL操作类(本人自己写的)
- 对依赖倒置原则(DIP)及Ioc、DI、Ioc容器的一些理解
- IOS高级编程之二:IOS的数据存储与IO
- 创业者拿到融资别高兴太早,当心TS中的优先清算权
- Android百度地图开发(四)线路搜索
- PowerMock简介
- Windows 窗体—— 键盘输入工作原理
- iOS常见的设计模式
- 网上流行的add(2)(3)(4)
- 非对称加密算法RSA--转
- JavaScript function函数种类(转)
- struts2中的使用BaseAction获取Session
- NOIP-螺旋矩阵
- 在VS中连接MySQL
- Hdoj 2191.悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 题解
- Confluence 6 禁用管理员联系表单
- bootstrapTable treegrid的使用
- @Async的使用
热门文章
- MySQL_插入更新 ON DUPLICATE KEY UPDATE
- 一、J2EE
- Linux下的Nginx的配置+Tomcat启动
- spring多个AOP执行先后顺序(面试问题:怎么控制多个aop的执行循序)
- LSTM UEBA异常检测——deeplog里其实提到了,就是多分类LSTM算法,结合LSTM预测误差来检测异常参数
- 牛客网 PAT 算法历年真题 1008 : 锤子剪刀布 (20)
- css 解决fixed 布局下不能滚动的问题
- mysql索引类型和方式
- linux下如何添加一个用户并且让用户获得root权限 备用
- Win10系列:VC++调用自定义组件1