mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
find bug when testing knn with kdtree -> fixed
This commit is contained in:
parent
af0909a40e
commit
ac0a2e1fc2
@ -105,6 +105,8 @@ func (t *Tree) buildHandle(data []int, featureIndex int) *node {
|
||||
n.left.srcRowNo = data[divPoint+1]
|
||||
} else if divPoint != (len(data) - 1) {
|
||||
n.right = t.buildHandle(data[divPoint+1:], (featureIndex+1)%len(t.data[data[0]]))
|
||||
} else {
|
||||
n.right = &node{feature: -2}
|
||||
}
|
||||
|
||||
return n
|
||||
@ -142,6 +144,8 @@ func (t *Tree) searchHandle(k int, disType pairwise.PairwiseDistanceFunc, target
|
||||
length := disType.Distance(vectorX, vectorY)
|
||||
h.insert(n.value, length, n.srcRowNo)
|
||||
return
|
||||
} else if n.feature == -2 {
|
||||
return
|
||||
}
|
||||
|
||||
dir := true
|
||||
|
Loading…
x
Reference in New Issue
Block a user