Skip to content
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

Evaluation scripts #164

Closed
wants to merge 7 commits into from
Closed

Evaluation scripts #164

wants to merge 7 commits into from

Conversation

alishbaimran
Copy link
Collaborator

  • Added scripts for generating figures for cosine similarity and UMAP/PCA

Copy link
Member

@mattersoflight mattersoflight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alishbaimran the logic and your plot read correctly. I am approving the merge so you can proceed. Please do the following:

  • Refactor computation of consine similarity and displacement to representation.viscy.evaluation.
  • Consistently plot cosine similarity and not introduce cosine dissimilarity.


# %% Function to compute the norm of differences between embeddings at t and t + tau
# %% Function to compute the norm of differences between embeddings at t and t + tau
def compute_displacement(embedding_dataset, max_tau=10, use_cosine=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alishbaimran this should be part of viscy.representation.evaluation. All algorithms should be there. The scripts should have only paths and plotting code.

@@ -83,85 +171,11 @@ def plot_umap_infection(features, infection, title):
plt.legend(loc='best')
plt.title("UMAP Plot - February Dataset with Mock, Zika, and Dengue Highlighted")
plt.show()
=======
plot_umap_histogram(feb_umap_data, feb_infection, "February Dataset")
>>>>>>> Stashed changes:applications/contrastive_phenotyping/contrastive_cli/figures/figure4/figure_a_1.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge error

@@ -68,7 +68,7 @@ def __init__(
self.l2_alpha = l2_alpha
self.ms_dssim_alpha = ms_dssim_alpha

@torch.amp.custom_fwd(device_type="cuda", cast_inputs=torch.float32)
@torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated diff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test will not pass otherwise. I can revert but tests will fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started the evaluation branch from the representation branch which does not have this change: https://github.com/mehta-lab/VisCy/blob/representation/viscy/translation/engine.py. How do I deal with this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull the base branch and rebase/merge based on your preference. Please consult Git documentation or search online.

Comment on lines 6 to 13
<<<<<<< Updated upstream:applications/contrastive_phenotyping/figures/figure_4e_2_feb.py

from viscy.representation.embedding_writer import read_embedding_dataset

=======
from pathlib import Path
from viscy.representation.embedding_writer import read_embedding_dataset
>>>>>>> Stashed changes:applications/contrastive_phenotyping/contrastive_cli/figures/figure4/figure_e_2_feb.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge error.

Copy link
Collaborator

@ziw-liu ziw-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix obvious version control errors before merging.

ziw-liu and others added 2 commits September 17, 2024 09:36
…et contrastive task (#154)

* wip: sample positive and negative samples from another time point

* configure time interval in triplet data module

* vectorized anchor filtering

* conditional augmentation for anchor
anchor is augmented if the positive is another time point

* example training script for the CTC dataset
this is optimized to run on MPS

* add example CTC prediction config for MPS
@alishbaimran alishbaimran deleted the evaluation branch September 17, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants