code: def flipsign(U):
      
      midx = abs(U).argmax(axis=0)
      for i in range(U.shape[1]):
          if U[midx[i], i] < 0:
              U[:, i] = -U[:, i]
      return U
docs: Flip sign of factor matrices such that largest magnitude
      element will be positive