From 457082ba6fae5b11ed5f3944e9c556bc04cec4e5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 29 Jun 2016 10:11:38 -0400 Subject: [PATCH] DRY up the computation of indexed, feature-assigned lists. --- src/Data/RandomWalkSimilarity.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/RandomWalkSimilarity.hs b/src/Data/RandomWalkSimilarity.hs index 342b615ac..f386237bb 100644 --- a/src/Data/RandomWalkSimilarity.hs +++ b/src/Data/RandomWalkSimilarity.hs @@ -28,10 +28,10 @@ rws compare getLabel as bs replace = (pure .) . Replace (p, q) = (2, 2) d = 15 - fas = zip (featurize <$> as) [0..] - fbs = zip (featurize <$> bs) [0..] + fas = featurize as + fbs = featurize bs kdas = KdTree.build (Vector.toList . fst . fst) fas - featurize = featureVector d . pqGrams p q getLabel &&& identity + featurize a = zip ((featureVector d . pqGrams p q getLabel &&& identity) <$> a) ([0..] :: [Integer]) findNearestNeighbourTo kv@((_, v), i) = do mapped <- get let ((k, nearest), j) = KdTree.nearest kdas kv