<p>Hi Yawei,</p>

<p>mlpack unfortunately doesn't have any current support for loading sparse matrices from disk.  In addition, because of this, the command-line programs only load dense data.</p>

<p>So if you want to use sparse data specifically, I think the best way is to write a C++ program using <code>arma::sp_mat</code>.  But to make it harder... Armadillo does not have good documentation for their support for loading sparse matrices.  You can load a coordinate list of the form</p>

<pre><code>1 2 10.3
3 1 5.2
3 2 1.3
</code></pre>

<p>and this represents a matrix with three nonzero elements.  You can load it using the function</p>

<pre><code>arma::sp_mat m;
m.load("file.txt", arma::coord_ascii);
</code></pre>

<p>and then you can use that in mlpack methods.  I wish that this was documented in the Armadillo docs but currently it is not.</p>

<p>I hope this is helpful... let me know if I can clarify anything.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/issues/656#issuecomment-222563391">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFP0XUZvNazFNCQ_Nkeht4t8bo_R4ks5qG2rFgaJpZM4IpQSX">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFOIArVG9fpyKHqmBN027MtzNz4yjks5qG2rFgaJpZM4IpQSX.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/656#issuecomment-222563391"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>