From fc7da6849c40cc0caef0e86e452f6d1e2c8320d0 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 25 May 2020 18:30:56 +0200 Subject: handle n len(X): + k_graph = len(X) need_knn = k_graph need_knn_ngb = True if self.density_type_ in ["DTM", "logDTM"]: - k = self.params_.get("k", 10) # FIXME: What if X has fewer than 10 points? + k = self.params_.get("k", 10) k_DTM = self.params_.get("k_DTM", k) + # If X has fewer than k points... + if k_DTM > len(X): + k_DTM = len(X) need_knn = max(need_knn, k_DTM) need_knn_dist = True # if we ask for more neighbors for the graph than the DTM, getting the distances is a slight waste, -- cgit v1.2.3