Created
October 21, 2019 18:39
-
-
Save igorbrigadir/73cba7061f1bde5a60dfbf939f4bdb03 to your computer and use it in GitHub Desktop.
Compute the distance between 2 correlation matrices. https://twitter.com/lopezdeprado/status/1186090591370842112
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def corrDist(corr0,corr1): | |
| num=np.trace(http://np.dot(corr0,corr1)) | |
| den=np.linalg.norm(corr0,ord='fro') | |
| den*=np.linalg.norm(corr1,ord='fro') | |
| cmd=1-num/den | |
| return cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment