-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: Imaginary component #15
Comments
Just browsing here for a different reason... just to make sure... does this also happen with more than 2 molecules? (since it calculates the variance...) |
renzph
added a commit
that referenced
this issue
Mar 29, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets.
renzph
added a commit
that referenced
this issue
Apr 1, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets.
renzph
added a commit
that referenced
this issue
Apr 1, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets.
renzph
added a commit
that referenced
this issue
Apr 1, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets.
renzph
added a commit
that referenced
this issue
Apr 1, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets.
renzph
added a commit
that referenced
this issue
Apr 1, 2024
1. Changes to `get_one_hot` Problems are given in: - #14 - #17 - #13 I discarded the changes in the PRs and and added more comprehensive handling of the input data in the `SmilesDataset` class and the `get_one_hot` function. 2. Imaginary components Frechet distance calculation fails to work for some cases because of badly conditioned matrices, as described here #15. Could not reproduce the error locally, but could do so on colab. Fixed it in `calculate_frechet_distance` by checking if the first `covmean` computation is real add a small value to the diagonal. This made it work for me and I got the same result as the original implementation run locally. 3. Added some more tests and changed to pytest 4. As described in #16 I changed the data type of the activations to float32 in the `get_predictions` function, which saves memory for larger datasets. 5. Change to pyproject.toml
Hey @parkyjmit, It turned out to be a numerical issue. I fixed it in the new release and it should be working on colab now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I've got an issue for get_fcd function.
I reproduced this error in google colab
and I've got this result.
ValueError Traceback (most recent call last)
in <cell line: 3>()
1 smiles_list1 = ['COc1cccc(NC(=O)Cc2coc3ccc(OC)cc23)c1', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
2 smiles_list2 = ['Oc1ccccc1-c1cccc2cnccc12', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
----> 3 get_fcd(smiles_list1, smiles_list2)
1 frames
/usr/local/lib/python3.10/dist-packages/fcd/utils.py in calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps)
171 if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):
172 m = np.max(np.abs(covmean.imag))
--> 173 raise ValueError("Imaginary component {}".format(m))
174 covmean = covmean.real
175
ValueError: Imaginary component 1.90603044681631e+39
Do you have any idea to solve this?
I have to get fcd value for my project
The text was updated successfully, but these errors were encountered: