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

simplify the selection of years in the training_pipeline #142

Merged
merged 11 commits into from
Nov 14, 2024

Conversation

JialuJialu
Copy link
Contributor

No description provided.

outcome_years_to_keep = [
year for year in outcome_years_to_keep if year in intervention.columns[2:]
]

Copy link
Contributor Author

@JialuJialu JialuJialu Aug 12, 2024

Choose a reason for hiding this comment

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

The line 106 to line 114 works the same as
outcome_years_to_keep = [year for year in outcome.columns[2:] if year in intervention.columns[2:]
It seems that the intent was to write
outcome_years_to_keep = [year for year in outcome.columns[2:] if year - forward_shift in intervention.columns[2:]

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, I think the issue was dropping a variable that was needed elsewhere.


for i in range(len(outcome_years_to_keep) - forward_shift):
outcome_shifted.iloc[:, i] = outcome_shifted.iloc[:, i + forward_shift]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The shifting could be completed in one step through renaming.

@rfl-urbaniak rfl-urbaniak requested a review from Niklewa August 14, 2024 14:10
Copy link
Collaborator

@Niklewa Niklewa left a comment

Choose a reason for hiding this comment

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

The improvements to modeling_utils.py look good.

The only issue is a linting error that is causing the checks to fail: it would reformat /home/runner/work/cities/cities/cities/__init__.py

Copy link
Contributor

@rfl-urbaniak rfl-urbaniak left a comment

Choose a reason for hiding this comment

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

Multiple tests fail as you removed a variable that is needed downstream. Also, changing the optimizer to abide by the lint is not recommended. It seems there is a bug in mypy where it doesn't seem to see things in torch.

pytorch/pytorch#33757

So instead I'd recommend ignoring this line by mypy and reverting to the original optimizer.

If you feel like fixing this, please do, if your otherwise preoccupied, lmk, we can stall this PR.

outcome_years_to_keep = [
year
for year in outcome.columns[2:]
if year_min <= int(year) <= year_max + forward_shift
if str(int(year) - forward_shift) in intervention.columns[2:]
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is what intended here but if you want to have the same behavior as before, change it to outcome_years_to_keep = [year for year in outcome.columns[2:] if year in intervention.columns[2:]]

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@rfl-urbaniak rfl-urbaniak dismissed Niklewa’s stale review November 14, 2024 12:55

Manually went over and agree. Minor issue no point in sending to re-review.

@rfl-urbaniak rfl-urbaniak merged commit 21f59c6 into main Nov 14, 2024
2 checks passed
@rfl-urbaniak rfl-urbaniak deleted the jialu-training-pipeline branch November 15, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants