From a6a538a27c5984369680dc68b0f97ea6a03e8e4f Mon Sep 17 00:00:00 2001 From: Nikhil Pimpalkhare Date: Mon, 12 Oct 2020 20:38:22 -0700 Subject: [PATCH] knearest fixed --- medleysolver/classifiers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/medleysolver/classifiers.py b/medleysolver/classifiers.py index e2bd85d..a454703 100644 --- a/medleysolver/classifiers.py +++ b/medleysolver/classifiers.py @@ -178,7 +178,9 @@ def get_ordering(self, point, count): if np.random.rand() >= self.epsilon * (self.decay ** count) and self.solved: candidates = sorted(self.solved, key=lambda entry: np.linalg.norm(entry.datapoint - point))[:self.k] methods = [x.solve_method for x in candidates] - order = sorted(random.shuffle(list(SOLVERS.keys())), key= lambda x: methods.count(x)) + ss = list(SOLVERS.keys()) + random.shuffle(ss) + order = sorted(ss, key= lambda x: methods.count(x)) else: order = Random.get_ordering(self, point, count)