[mlpack-git] [mlpack] Fix bug #358 (CosineTreeTest/CosineNodeCosineSplit test sometimes fails, only on i386) (#581)

lozhnikov notifications at github.com
Thu Mar 17 18:41:07 EDT 2016


I think I solved the problem.

This problem happens due to miscalculations.
The cosines and cosineMax are computed two times (in CosineTree::CosineNodeSplit and in the test).
And the first cosineMax may differ significantly from the second one.

For example, look at the debug output below
`THIS IS TREE 0xbcbe978`
`cosineMax = 0.99999999999999988898`
`cosineMin = 0.73421824357373099978`
`cosines`
`0.75763372746624790821 0.75999261009165319791 0.75479082605226166525` `0.75788044353107164586 0.99999999999999988898 0.73421824357373099978 `
`THIS IS TEST 0xbcbe978`
`TreeDepth = 11`
`cosineMax = 0.75999261009165330893`
`cosineMin = 0.73421824357373111081`
`cosines`
`1 0.75763372746624801923 0.75999261009165330893 0.75479082605226177627` `0.7578804435310718679 0.73421824357373111081 `

All sets differ by a calculational accuracy of double (about 1e-16 around 1.0).
And the first cosineMax differs significantly from the second one because the second one equals 1 exactly (`cosineMax = arma::max(cosines % (cosines < 1));`).

I suggest to compare doubles with some precision. I correct the test. This should fix the problem.
You can view, comment on, or merge this pull request online at:

  https://github.com/mlpack/mlpack/pull/581

-- Commit Summary --

  * Fix bug #358 (CosineTreeTest/CosineNodeCosineSplit test sometimes fails, only on i386)

-- File Changes --

    M src/mlpack/tests/cosine_tree_test.cpp (60)

-- Patch Links --

https://github.com/mlpack/mlpack/pull/581.patch
https://github.com/mlpack/mlpack/pull/581.diff

---
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/pull/581
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160317/f0a60404/attachment.html>


More information about the mlpack-git mailing list