modified ubdt demo, added distance-dependent knn