ボール ツリー オブジェクトのリストを以下のように定義しました。ここで、input1
は形状 (100, 320) の NumPy 配列です。
bt = []
bt.append(BallTree(input1))
の要素の 1 つをinput1
サンプル クエリとして取り上げます。ここで、sample_index
は境界内にあると想定されます。
sample_query = input1[sample_index,:]
# Find nearest neighbour and compute distance and index
distance, index = bt[0].query(sample_query,1)
ここで、distance[0]
「sample_query」が のメンバーであることを考えると、期待どおり は 0 ですinput1
。
# Adding another BallTree instance to the list
#input2 is a numpy array with shape (70,320)
bt.append(BallTree(input2))
distance, index = bt[0].query(sample_query,1)
print distance[0]
# Output here is NOT zero (NOT expected!!)
ボール ツリー リスト 'bt' にボール ツリー オブジェクトをもう 1 つ追加すると、'sample_query' と bt[0] の最近傍距離が変わるのはなぜですか? リスト bt にもう 1 つのオブジェクトを追加すると、オブジェクト bt[0] は変更されないことが予想されます。私の期待は正しいですか?