Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.
This repository was archived by the owner on May 9, 2025. It is now read-only.

[bug report] GTC seems incorrect. #49

@ncble

Description

@ncble

Describe the bug
In current master branch, we calculate the GTC by calling srl_zoo/plotting/representation_plot.py. In particular, in the function plotCorrelation, we call numpy to compute the correlation.

corr = np.corrcoef(x=x + eps, y=states_rewards["states"] + eps, rowvar=0)

However in the numpy.corrcoef doc, they spefify that numpy.corrcoef(x, y=None, rowvar=True, bias=<no value>, ddof=<no value>) y should have the same shape as x. In fact, if we replace this line of code by

corr = np.corrcoef(x=x + eps, y=np.random.rand(x.shape[0], 200) + eps, rowvar=0) ## where 200 is the state dim

and execute N times, the results will be almost the same (absolute difference is less than 1e-5).

Code example
Replace the predcited state by a random matrix as described above and execute the following command line under the folde srl_zoo/ :

$ python -m plotting.representation_plot -i "./logs/mobile2D_random_tar_seed_0/19-05-28_18h28_22_custom_cnn_ST_DIM200_autoencoder/states_rewards.npz" --correlation --data-folder "mobile2D_random_tar_seed_0" --print-corr

p.s. replace the folder name 19-05-28_18h28_22_custom_cnn_ST_DIM200_autoencoder according to yours, of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions