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

save validation batch results to wandb #252

Merged
merged 21 commits into from
Sep 12, 2024
Merged

save validation batch results to wandb #252

merged 21 commits into from
Sep 12, 2024

Conversation

peterdudfield
Copy link
Contributor

@peterdudfield peterdudfield commented Sep 5, 2024

Pull Request

Description

Save csv of validation results to weights and biases

This is done by

  • results being appended each validation step,
  • saved all together at the end of the validation step

How Has This Been Tested?

CI tests

  • local test with script
import wandb
import pandas as pd

run = wandb.init(
    project="test",
    notes="My first experiment",
)

# make random dataframe
df = pd.DataFrame({
    "a": [1, 2, 3],
    "b": [4, 5, 6]
})

i=2
validation_artifact = wandb.Artifact(f"validation_results_{i}", type="dataset")
df.to_csv(f"validation_results_{i}.csv", index=False)
validation_artifact.add_file(f"validation_results_{i}.csv")
wandb.log_artifact(validation_artifact)

Screenshot 2024-09-05 at 16 15 28

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@peterdudfield peterdudfield marked this pull request as draft September 5, 2024 15:27
@peterdudfield peterdudfield marked this pull request as ready for review September 5, 2024 16:23
@peterdudfield peterdudfield requested a review from dfulu September 5, 2024 16:24
pvnet/models/base_model.py Show resolved Hide resolved
results_df = pd.DataFrame(
{
"y": y_i,
"y_hat": y_hat_i,
Copy link
Member

Choose a reason for hiding this comment

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

Have you done a training run with this? When predicting quantiles, I think y_i and y_hat_i will be different shapes

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 havent done training, but the end2end test does go through here.

becasue i take y = batch[self._target_key][:, -self.forecast_len :, 0], it makes it the same length as y_hat.

Perhaps theres a better way to standardised that. something for the future

Copy link
Member

Choose a reason for hiding this comment

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

Yeh but I think in this case, y_i is a vector with shape (horizon_step,). But y_hat_i can either be a vector with shape (horizon_step,) or (horizon_step, quantile,) depending on whether we are training to predict quantiles or only a central value. The end2end test only tests non-quantile training.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh good point. ill have a think about the qunalite things. Good catch on that

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 should have it now

pvnet/models/base_model.py Outdated Show resolved Hide resolved
@dfulu
Copy link
Member

dfulu commented Sep 5, 2024

I think there are a couple of things to sort out, but otherwise looks alright :)

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.62%. Comparing base (bdbe00a) to head (156fdfa).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
pvnet/models/base_model.py 94.28% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #252      +/-   ##
==========================================
+ Coverage   59.00%   59.62%   +0.61%     
==========================================
  Files          29       29              
  Lines        1893     1927      +34     
==========================================
+ Hits         1117     1149      +32     
- Misses        776      778       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterdudfield peterdudfield merged commit 280dc2c into main Sep 12, 2024
2 of 3 checks passed
@dfulu dfulu deleted the issue.csv branch November 13, 2024 11:26
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