code: def distance(self, x, y):
          
  
          if scipy.sparse.issparse(x):
              x = x.toarray().ravel()
              y = y.toarray().ravel()
          return 1.0 - numpy.dot(x, y)
docs: Computes distance measure between vectors x and y. Returns float.