Numpy memory error
<p>I'm running into a memory error issue with numpy. The following line of code seems to be the issue:</p>

<pre><code>self.D_r = numpy.diag(1/numpy.sqrt(self.r))
</code></pre>

<p>Where self.r is a relatively small numpy array.</p>

<p>The interesting thing is I monitored the memory usage and the process took up at most 3% of the RAM on the machine. So I'm thinking there's something that is killing the script before all the RAM is taken up because there is an expectation that the process will do so. If anybody has any ideas I would be very grateful. </p>

<p><strong>Edit 1:</strong> </p>

<p>Here's the traceback:</p>

<pre><code>Traceback (most recent call last):
File "/path_to_file/my_script.py", line 82, in &lt;module&gt;
mca_X = mca.mca(X)
File "/path_to_file/mca.py", line 54, in __init__
self.D_r = numpy.diag(1/numpy.sqrt(self.r.values))
File "/path_to_file/numpy/lib/twodim_base.py", line 302, in diag
res = zeros((n, n), v.dtype)
MemoryError
</code></pre>

<p>Running the script on KDD Cup 99 data (with one-hot-encoded nominal variables).</p>