gallantlab / pyrcca

Regularized kernel canonical correlation analysis in Python
Other
242 stars 73 forks source link

list() all zip items #12

Closed ytang07 closed 3 years ago

ytang07 commented 5 years ago

pyrcca doesn't work for py3 unless the zips are list()ed, to fix this, simply implement in rcca.py:

(line 65) resids = [abs(d[0]-d[1]) for d in list(zip(vdata, preds))] (line 151) indchunks = list(zip([iter(range(nT))] chunklen)) (line 197) indchunks = list(zip([iter(range(nT))] chunklen)) (line 329) def _listdot(d1, d2): return [np.dot(x[0].T, x[1]) for x in list(zip(d1, d2))] (line 340) for (ai, aj) in list(zip(a[i].T, a[j].T))]

lguangyu commented 5 years ago

Good suggesting. another approach is adding below two lines on the top of the rcca.py, which changes all zips in that module:

system_zip = zip zip = lambda x: list(system_zip(x))

It seems the repo is not quite maintained after the paper's publication, and py3 compatibility seems never considered. I'm also experiencing other shape issues even the last commit almost one year ago is titled 'bug fix for shapes'

TomDLT commented 3 years ago

Fixed in #13, thanks