[mlpack-git] [mlpack] Create a function to visualize the features learned by sparse autoencoder (#465)

Ryan Curtin notifications at github.com
Fri Nov 20 13:46:41 EST 2015


No interpolation necessary; this is all just reshaping.  I thought that the idea was that a user passed in a matrix with each of the maximal hidden units in columns, and the user gets back a matrix where each maximal hidden unit has been reshaped into a block, and the matrix is made up of these blocks.  Please correct me if I'm misunderstanding.  Anyway, suppose you have the following maximal inputs:

```
[[1 1 1 1]
 [2 2 2 2]
 [3 3 3 3]
 [4 4 4 4]]
```

and if we specify a padding of 1 and a padding value of 0, a block arrangement of 2x2, and an individual block size of 2x2, we get back

```
[[0 0 0 0 0 0 0]
 [0 1 1 0 2 2 0]
 [0 1 1 0 2 2 0]
 [0 0 0 0 0 0 0]
 [0 3 3 0 4 4 0]
 [0 3 3 0 4 4 0]
 [0 0 0 0 0 0 0]]
```

Is that correct for what the function is supposed to do?  If so, we do still have some free parameters.  Maybe the user wants a different block size, like 1x4, so they get back

```
[[0 0 0 0 0 0 0 0 0 0 0]
 [0 1 1 1 1 0 2 2 2 2 0]
 [0 0 0 0 0 0 0 0 0 0 0]
 [0 3 3 3 3 0 4 4 4 4 0]
 [0 0 0 0 0 0 0 0 0 0 0]]
```

Anyway, if we're on the same page about what the function should do, then I think that all that needs to be done to accomplish this is to modify the constructor of `ColumnsToBlocks(arma::uword rows, arma::uword cols)` to something more like `ColumnsToBlocks(arma::uword rows, arma::uword cols, arma::uword blockWidth, arma::uword blockHeight)` where `blockWidth * blockHeight` must be equal to the number of rows in the input matrix (so no interpolation is necessary).

(Also, as a side note, I'd suggest using `size_t` instead of `arma::uword` despite the fact that in some cases they may not be exactly the same type.  I'd like to force Armadillo to use `size_t` always, because `size_t` is a perfect type to represent indices, but I haven't yet figured out what needs to be done at configure time for that.)

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/465#issuecomment-158489256
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20151120/4217e518/attachment.html>


More information about the mlpack-git mailing list