[mlpack-git] [mlpack/mlpack] RandomizedSVD tests sometimes have failing LU decomposition (#783)

Ryan Curtin notifications at github.com
Tue Sep 13 23:31:18 EDT 2016


I noticed that the test `RandomizedSVDTest/RandomizedSVDReconstructionError` is sometimes failing.  It's straightforward to reproduce:

1. Add `math::RandomSeed(std::time(NULL))` to the top of the test in `randomized_svd_test.cpp`.
2. Rebuild `mlpack_test` and run as `while(true); do bin/mlpack_test -t RandomizedSVDTest; sleep 1; done`
3. Wait a few trials and it will probably fail.  On my system it fails maybe 10% of the time.

I see that the first several lines of the test appear to be written in order to carefully generate a positive definite non-square matrix, with singular values [1 0.1 0.01].  But it seems as though the singular values are not preserved when the matrix is centered.  If I add the following code:

```
std::cout << "data: " << arma::svd(data).t();
std::cout << "centered data: " << arma::svd(centeredData).t();
```

Then I get output like this when I run the test:

```
Running 1 test case...
data:    1.0000   0.1000   0.0100
centered data:    2.5269e-01   3.5332e-02   5.7466e-17

warning: lu(): decomposition failed

error: matrix multiplication: incompatible matrix dimensions: 10x3 and 0x0
unknown location(0): fatal error in "RandomizedSVDReconstructionError": std::logic_error: matrix multiplication: incompatible matrix dimensions: 10x3 and 0x0

*** 1 failure detected in test suite "mlpackTest"
```

It doesn't look much different when it's not failing:

```
Running 1 test case...
data:    1.0000   0.1000   0.0100
centered data:    9.7937e-01   9.7828e-02   5.3800e-17
```

Is it possible the data centering operation needs to be changed or ignored altogether?  I haven't thought about it in much detail since it is late right now... @zoq, any ideas here?  You originally wrote this code so maybe you have a quick fix. :)

-- 
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/783
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160913/7955ac40/attachment.html>


More information about the mlpack-git mailing list