fixed aps_extractor so that it will adaptively set n_neigh
more safeguards in aps_extractor's bayesian routine