Usage of generative model

To use the generative model, import and instantiate a GEMMR object

In [1]: from gemmr.generative_model import GEMMR

In [2]: gm = GEMMR('cca', wx=10, wy=5, r_between=0.3)

Here, we have set the number of X and Y features to 10 and y, respectively, and the between-set correlation to 0.3. With this, synthetic data can be generated:

In [3]: X, Y = gm.generate_data(n=1234)

As a sanity check, we can analyze these data with CCA.

In [4]: from gemmr.estimators import SVDCCA

In [5]: cca = SVDCCA().fit(X, Y)

Inspecting the estimated canonical correlation, we get

In [6]: cca.corrs_
Out[6]: array([0.36909802])

and we see that it is close to the assumed one in the generative model (0.3).