From f9032bc43486891406b9942ac63ec7746098cdd0 Mon Sep 17 00:00:00 2001 From: Jorn Hoofwijk <jornhoofwijk@gmail.com> Date: Mon, 29 Oct 2018 15:48:26 +0100 Subject: [PATCH] take the correct neigbours into account --- adaptive/learner/learner1D.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adaptive/learner/learner1D.py b/adaptive/learner/learner1D.py index f571b33f..d53b15bb 100644 --- a/adaptive/learner/learner1D.py +++ b/adaptive/learner/learner1D.py @@ -74,9 +74,10 @@ def triangle_loss(interval, scale, data, neighbors): x_left, x_right = interval xs = [x_left, x_right] if x_left in neighbors: - xs.insert(0, neighbors[x_left][1]) + xs.insert(0, neighbors[x_left][0]) if x_right in neighbors: - xs.append(neighbors[x_right][0]) + xs.append(neighbors[x_right][1]) + xs = [x for x in xs if x is not None] if len(xs) <= 2: return (x_right - x_left) / scale[0] -- GitLab