[mlpack-git] [mlpack/mlpack] The format of the sparse instances in the input file (#656)

Ryan Curtin notifications at github.com
Mon May 30 18:55:01 EDT 2016


Hi Yawei,

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.

So if you want to use sparse data specifically, I think the best way is to write a C++ program using `arma::sp_mat`.  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

```
1 2 10.3
3 1 5.2
3 2 1.3
```

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

```
arma::sp_mat m;
m.load("file.txt", arma::coord_ascii);
```

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

I hope this is helpful... let me know if I can clarify anything.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/656#issuecomment-222563391
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160530/d9eb127c/attachment.html>


More information about the mlpack-git mailing list