title: numpy.ndarray sparse matrix to dense
body: <p>I want to run <code>sklearn</code>'s <code>RandomForestClassifier</code> on some data that is packed as a <code>numpy.ndarray</code> which happens to be sparse.
  Calling <code>fit</code> gives <code>ValueError: setting an array element with a sequence.</code>. From other posts I understand that random forest cannot handle sparse data.</p>
  
  <p>I expected the object to have a <code>todense</code> method, but it doesn't.</p>
  
  <pre><code>&gt;&gt;&gt; X_train
  array(&lt;1443899x1936774 sparse matrix of type '&lt;class 'numpy.float64'&gt;'
      with 141256894 stored elements in Compressed Sparse Row format&gt;,
        dtype=object)
  &gt;&gt;&gt; type(X_train)
  &lt;class 'numpy.ndarray'&gt;
  </code></pre>
  
  <p>I tried wrapping it with a SciPy <code>csr_matrix</code> but that gives errors as well.</p>
  
  <p>Is there any way to make random forest accept this data?
  (not sure that dense would actually fit in memory, but that's another thing...)</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>The code generating the error is just this:</p>
  
  <pre><code>X_train = np.load('train.npy') # this returns a ndarray
  train_gt = pd.read_csv('train_gt.csv')
  
  model = RandomForestClassifier()
  model.fit(X_train, train_gt.target)
  </code></pre>
  
  <p>As for the suggestion to use <code>toarray()</code>, ndarray does not have such method.
  <code>AttributeError: 'numpy.ndarray' object has no attribute 'toarray'</code></p>
  
  <p>Moreover, as mentioned, for this particular data I would need terabytes of memory to hold the array. Is there an option to run <code>RandomForestClassifier</code> with a sparse array?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>It seems that the data should have been saved using SciPy's sparse as mentioned here <a href="https://stackoverflow.com/questions/8955448/save-load-scipy-sparse-csr-matrix-in-portable-data-format">Save / load scipy sparse csr_matrix in portable data format</a>.
  When using NumPy's save/load more data should have been saved.</p>