Mar. 1st, 2007

gusl: (Default)
My refactoring fastICA was performing better than fastICA itself (better agreement with R), so I went hunting for the difference.

This is my "buggy" code:
    DoubleMatrix2D resultMatrix = (DoubleMatrix2D) inVectors.clone();

The "clone" is deceptive: essentially, resultMatrix is going to have the same pointers as inVectors... so changing entries in resultMatrix changes them in inVectors.

This is the correct way to clone:
    DoubleMatrix2D resultMatrix = new DenseDoubleMatrix2D(convert(inVectors));


I think there may be a mathematical reason why using the resultMatrix is superior to using inVectors, despite the FastICA implementation.

Another possibility is that the R implementation has the exact same bug as the one I introduced in my poorly-executed "cloning".

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags