def test_pca_preconditioner_logjacobian(self): eigenvalues = rand(5) + .5 meanIn = randn(5, 1) meanOut = randn(2, 1) whiteIn = randn(5, 5) whiteIn = dot(whiteIn, whiteIn.T) whiteOut = randn(2, 2) whiteOut = dot(whiteOut, whiteOut.T) predictor = randn(2, 5) wt = PCAPreconditioner(eigenvalues, meanIn, meanOut, whiteIn, inv(whiteIn), whiteOut, inv(whiteOut), predictor) self.assertAlmostEqual( mean(wt.logjacobian(randn(5, 10), randn(2, 10))), slogdet(whiteOut)[1])
def test_pca_preconditioner_logjacobian(self): eigenvalues = rand(5) + .5 meanIn = randn(5, 1) meanOut = randn(2, 1) whiteIn = randn(5, 5) whiteIn = dot(whiteIn, whiteIn.T) whiteOut = randn(2, 2) whiteOut = dot(whiteOut, whiteOut.T) predictor = randn(2, 5) wt = PCAPreconditioner( eigenvalues, meanIn, meanOut, whiteIn, inv(whiteIn), whiteOut, inv(whiteOut), predictor) self.assertAlmostEqual(mean(wt.logjacobian(randn(5, 10), randn(2, 10))), slogdet(whiteOut)[1])