View Single Post
  #55  
02-06-2017, 11:16 AM
Nate's Avatar
Nate
Oddworld Administrator
Rainbow of Flavour
 
: Apr 2002
: Seattle (woo!)
: 16,311
Blog Entries: 176
Rep Power: 42
Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)Nate  (13497)

:
You should (break your NDA) and show us the code, we can see who here can get the best time complexity.
Okay, here goes (for one part of it, at least):


:
def findCentroid(docMatrix):
    valArrayTransposed = getArray(docMatrix).transpose()
    return asarray([mean(row) for row in valArrayTransposed]
vs

:
def findCentroid(docMatrix):
    return docMatrix.sum(axis=0)/docMatrix.shape[0]
As you can see, it's less to do with algorithmic complexity and more to do with understanding how scipy matrixes operate.
__________________
:
Spending as long as I do here, it's easy to forget that Oddworld has actual fans.

Reply With Quote