This file contains 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
'''Python library for decorrelating and correlating data | |
Forked from joelouismarino/whiten.py. | |
Also based on R's rdrr.io/cran/whitening/src/R/whiteningMatrix.R, | |
and an SAS blog post: | |
blogs.sas.com/content/iml/2012/02/08/use-the-cholesky- | |
transformation-to-correlate-and-uncorrelate-variables.html | |
''' | |
import numpy as np | |
import scipy.linalg as la |
This file contains 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
"""noint: Shield a code block or function from SIGINT. | |
Based on: http://stackoverflow.com/a/21919644/487556. | |
Useful for running training loops in Jupyter: if your learning | |
step is inside a `with noint:`, when you want to interrupt your | |
training routine, you can do that without getting halfway through | |
some set of operations and leaving the model state inconsistent, | |
which would make it impossible to rerun the cell without | |
restarting the whole training loop. |