title: MemoryError while using cca.fit in Python
body: <p>I'm trying to perform the Canonical Correlation Analysis (CCA) using <code>CCA</code> imported from <code>sklearn.cross_decomposition</code>.</p>
  
  <p>When I executed the following commands:</p>
  
  <pre><code>cca=CCA(n_components=1)
  
  cca.fit(A,B)
  </code></pre>
  
  <p>The following error occured:</p>
  
  <pre><code>Traceback (most recent call last):
    File "processing.py", line 386, in &lt;module&gt;
      cca_implementation()
  
    File "processing.py", line 368, in cca_implementation
      cca.fit(A,B)
  
    File "/home/sandy/anaconda/lib/python2.7/site-packages/sklearn/cross_decomposition/pls_.py", line 278, in fit
      tol=self.tol, norm_y_weights=self.norm_y_weights)
  
    File "/home/sandy/anaconda/lib/python2.7/site-packages/sklearn/cross_decomposition/pls_.py", line 39, in _nipals_twoblocks_inner_loop
      X_pinv = linalg.pinv(X)   # compute once pinv(X)
  
    File "/home/sandy/anaconda/lib/python2.7/site-packages/scipy/linalg/basic.py", line 603, in pinv
      b = np.identity(a.shape[0], dtype=a.dtype)
  
    File "/home/sandy/anaconda/lib/python2.7/site-packages/numpy/core/numeric.py", line 2054, in identity
      return eye(n, dtype=dtype)
  
    File "/home/sandy/anaconda/lib/python2.7/site-packages/numpy/lib/twodim_base.py", line 211, in eye
      m = zeros((N, M), dtype=dtype)
  
  MemoryError
  </code></pre>
  
  <p>Where the dimensions of <code>A</code> are 38195 X 21, and the dimension of <code>B</code> are 38195 X 18.</p>
  
  <p>Can someone help me in resolving this problem?
  Is there any other way to find the <code>cca</code> more efficiently in Python.</p>