1. Lars Yencken
  2. simsearch

Commits

Lars Yencken  committed 956461f

Fixes two minor bugs in search simulation.

  • Participants
  • Parent commits 5176745
  • Branches default

Comments (0)

Files changed (1)

File simsearch/experiments/simulate_search.py

View file
         neighbours = _get_neighbours(new_query, k=k)
 
         if target in neighbours:
-            if error_rate == 0.0 or random.random < (1 - error_rate)**k:
+            if error_rate == 0.0 or random.random() < (1 - error_rate)**k:
                 # Success!
                 path.append(target)
                 return path
     return path
 
 def _breadth_first_search(query, target, limit=5,
-        k=settings.N_NEIGHBOURS_RECALLED):
+        k=settings.N_NEIGHBOURS_RECALLED, error_rate=0.0):
     """
     Perform breadth first search to a fixed depth limit, returning the
     shortest path from the query to the target (within the limit).