Skip to content

Conversation

@wael-mika
Copy link
Contributor

Description

Implemented Healpix cropping as discussed with three different methods for spatial cover. The code also supports different overlaps between crops provided for the teacher and the student and corrects the bug when passing num_sample > 1. In the config, three different examples were provided on how to set up cropping; it was tested on the Juwels booster and it ran for few epochs.

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

Copy link
Collaborator

@clessig clessig left a comment

Choose a reason for hiding this comment

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

Thanks. I left some comments. Did you generate plots of the different masks, as discussed. The final correctness is really hard to judge from reading the code or even running it.

mask = np.zeros(num_cells, dtype=bool)
mask[child_indices] = True

elif strategy == "cropping_healpix":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we put this into a separate function

# iterate over all target samples
target_masks: list[np.typing.NDArray] = []
target_metadata: list[SampleMetaData] = []
target_config_mapping = [] # Track which config each target mask came from
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need the target_config_mapping. The target_metadata should contain all relevant information, not?

overlap_set = set(overlap_with)

# Use intelligent center selection based on overlap target
if overlap_ratio > 0.7:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does the 0.7 and the 0.3 below come from?

crop2 = _select_spatially_contiguous_cells(0, 9, method="geodesic_disk",
overlap_with=crop1, overlap_ratio=0.3)
"""
import warnings
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put all imports at the beginning of the file

"""
self.rng = rng

def _select_spatially_contiguous_cells(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should break this function up into smaller functions that cover the different branches. The overall flow is difficult to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants