Finding the correlation matrix

后端 未结 3 1351
暗喜
暗喜 2020-12-08 23:17

I have a matrix which is fairly large (around 50K rows), and I want to print the correlation coefficient between each row in the matrix. I have written Python code like this

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 00:08

    you can use the python multiprocess module, chunk up your rows into 10 sets, buffer your results and then print the stuff out (this would only speed it up on a multicore machine though)

    http://docs.python.org/library/multiprocessing.html

    btw: you'd also have to turn your snippet into a function and also consider how to do the data reassembly. having each subprocess have a list like this ...[startcord,stopcord,buff] .. might work nicely

    def myfunc(thelist):
        for i in xrange(thelist[0]:thelist[1]):
        ....
        thelist[2] = result
    

提交回复
热议问题