I am trying to generate matrices with independent columns. At the moment I am using assume which works, but requires a lot of computation:
import sys
import hypothesis.strategies as st
import numpy as np
from hypothesis import assume
from hypothesis.extra.numpy import arrays
@st.composite
def data(draw, shape):
elements = st.floats(min_value=-10, max_value=10)
X = draw(arrays(np.float, shape, elements=elements))
# independence check
assume(np.linalg.cond(np.dot(X.T, X)) < 1 / sys.float_info.epsilon)
return X
Is there a better way to directly create a matrix X with independent columns?