Modifying logic for similarity computation
This commit is contained in:
parent
b1824bac53
commit
6f57277ed3
5
util.go
5
util.go
@ -73,8 +73,9 @@ func similarity(features1 featureMap, features2 featureMap) float64 {
|
|||||||
var result float64
|
var result float64
|
||||||
|
|
||||||
for key, value1 := range features1 {
|
for key, value1 := range features1 {
|
||||||
value2, _ := features2[key]
|
if value2, ok := features2[key]; ok {
|
||||||
result += 1 - math.Abs(value1-value2)
|
result += value1 * value2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user