Comments (16)
[deleted comment]
from efficient-java-matrix-library.
Thanks for reporting the bug. It was an easy to fix bug. Check out the latest
SVN code to get the fix. You also might want to consider using
DecompositionFactory.svd(true,true,true) instead of directly creating an
instance of class SvdImplicitQrDecompose.
Original comment by [email protected]
on 26 Jun 2010 at 12:58
from efficient-java-matrix-library.
Thanks for the quick reply! I will verify the fix on my data set tomorrow and
post back.
On the topic of DecompositionFactory, my application does not need V to be
computed, yet it looks like the "needsV" flag of DecompositionFactory#svd has
no impact on the selected algorithm. More specifically my application is a
simple PCA, where all I need is the U vector to project the data points (PCA =
transpose(m) * u). Since not computing V would halve the memory requirement,
this is very ideal ... do you have any plans to implement the "needsV" flag in
the future?
Original comment by [email protected]
on 27 Jun 2010 at 6:04
from efficient-java-matrix-library.
You're welcome. I am planning on adding that functionality. Not exactly sure
when, but since there is a need for it I'll see if I can do it this week. Let
me know how the run through your data goes.
Original comment by [email protected]
on 28 Jun 2010 at 9:31
from efficient-java-matrix-library.
Hi Peter, I updated the code today and caught your fixes -- including new
"needU"/"needV" support! Tried it out, looks good. Actually, surprisingly,
EJML's SVD is running faster than GSL's SVD (which uses CBLAS). I haven't done
a thorough comparison yet, but the results from EJML look as expected. Thanks.
Original comment by [email protected]
on 30 Jun 2010 at 4:06
from efficient-java-matrix-library.
Regarding GSL, in my application, EJML singular values (from the QR implicit
solver) differ from GSL's from the modified Golub-Reinsch (described at
http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.ht
ml) by at most +-0.25 .
Original comment by [email protected]
on 30 Jun 2010 at 4:26
from efficient-java-matrix-library.
Yep I ended up messing with this a bit longer last night than I planned. The
SVD algorithm is about 50% faster since I realized that something it was doing
was redundant. Then there is another significant speed up by not computing V.
Thanks for pointing out GSL. I was not aware of that package.
For the difference between GSL and EJML. You can verify the correctness of
both SVD algorithms by; 1) computing the SVD of A, 2) recomputing A'=U S V^T,
and 3) computing the norm2 of the difference |A-A'| which will hopefully be a
small number, around 1e-15.
I did run EJML's SVD through a battery of tests to check its correctness, but
there are some special cases not tested yet. I suspect this might have
something to do with nearly identical singular values. Those are common in
larger matrices which I haven't tested extensively yet.
If it looks like a problem in EJML then could you create a new issue and attach
an example matrix?
Original comment by [email protected]
on 30 Jun 2010 at 4:48
from efficient-java-matrix-library.
Actually, some bad news, I hit the problem again, with a new matrix. The
serialized double array (matrix.getData()) is attached.
Exception in thread "main" java.lang.IllegalArgumentException: Specified
element is out of bounds
at org.ejml.data.DenseMatrix64F.set(DenseMatrix64F.java:227)
at org.ejml.ops.SingularOps.descendingOrder(SingularOps.java:76)
...
Original comment by [email protected]
on 1 Jul 2010 at 2:53
Attachments:
from efficient-java-matrix-library.
Btw, please let me know if there's anything I can contribute. I'm not a expert
in linear algebra by any means, though.
Original comment by [email protected]
on 1 Jul 2010 at 2:54
from efficient-java-matrix-library.
Not sure if I did it right, but when I deserialized that file all I got was a
very large double[]. Since I don't know the number of rows or columns it
couldn't use it. But I think I know what happened anyways.
I'm guessing that you passed true to getU() or getV(). DescendingOrder() used
to assume that both matrices are not transposed. If you update to the latest
SVN that problem should be fixed.
-----
Thanks for the helping out offer. There is plenty to do. Finding bugs is
always useful. Feedback on the documentation and the API. Is the
documentation useful? Is the API easy to use and reasonably intuitive?
Original comment by [email protected]
on 1 Jul 2010 at 10:50
from efficient-java-matrix-library.
The matrix is 9025 x 2336 .
Here's the code I use to do a PCA:
SingularValueDecomposition svd = DecompositionFactory.svd(false, true, true);
svd.decompose(mt);
final DenseMatrix64F s = svd.getW(null);
final DenseMatrix64F v = svd.getV(false);
// Problem:
SingularOps.descendingOrder(null, s, v);
// Resize v
// ...
// CommonOps.mult(mt, vsub, pca);
Original comment by [email protected]
on 1 Jul 2010 at 3:32
from efficient-java-matrix-library.
Hi Peter, just a quick note, I updated to the latest code, #checkSvdMatrixSize
may not account for a null U/V matrix.
Original comment by [email protected]
on 2 Jul 2010 at 4:30
from efficient-java-matrix-library.
The problem is actually inside of the SVD algorithm. If it gets two numbers
that are very small in a particular part they become zero when multiplied
together. This eventually causes a divided by zero error and NaN for singular
values. That intern hosed descendingOrder().
There is also a bug in descendingOrder() that's in SVN right now where it
doesn't check to see of a matrix is null before using it.
I almost got a fix for all of these issues ready to go, but I just found a
matrix that causes some problems.
Original comment by [email protected]
on 2 Jul 2010 at 4:46
from efficient-java-matrix-library.
Just committed a candidate fix to all of these problems. Also created a new
issue for the SVD divided by zero problem. The current code can process the
matrix you provided.
Can you run this through your data and tell me if you encounter any problems?
Original comment by [email protected]
on 2 Jul 2010 at 5:10
from efficient-java-matrix-library.
Just an update, I've been running with the candidate code for the past week.
Everything checks out so far -- no problems.
Original comment by [email protected]
on 12 Jul 2010 at 4:26
from efficient-java-matrix-library.
Thanks for the update. The latest SVN should be a little bit more accurate
than what you are running and descendingOrder() can handle inputs with NaN in
it. If everything still seems to be going well i'll close the other issue.
http://code.google.com/p/efficient-java-matrix-library/issues/detail?id=6
Original comment by [email protected]
on 12 Jul 2010 at 9:53
from efficient-java-matrix-library.
Related Issues (20)
- Request for additional element-wise matrix operators HOT 1
- MatrixFeatures.isPositiveDefinite modifies the matrix if sandwiched with invert() HOT 1
- Add support for matrices with zero dimensions HOT 1
- Request for adding a multiplication method for more than two matrices HOT 2
- There's problem at Big matrix HOT 1
- Add flag to automatically order singular values in SVD HOT 1
- Erroneous calculation of the determinant of a matrix HOT 6
- Matrix inversion should fail if matrix contains NaN HOT 1
- Matrix reshape question HOT 1
- CovarianceRandomDraw documentation incorrectly states that argument cov is no modified HOT 1
- Add complex eigenvectors
- LinearSolver (symmPosDef) doesn't appear to work at all. HOT 1
- LinearSolverChol::solve(B,X) - obvious BUG in dimensions check HOT 1
- SimpleMatrix invert: no exception for singular matrix HOT 6
- Searching for org.ejml.simple HOT 1
- make 32bit float (float) versions of all matrices HOT 1
- possible problem with solve with larger dimensions HOT 1
- Add RandomMatrix.setGaussian() HOT 2
- Matrix rank seems incorrect for large matrices HOT 3
- SimpleBase.loadCSV is not extensible HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficient-java-matrix-library.