Skip to content

Commit

Permalink
Merge pull request #13 from openclimatefix/issue/rm-nowcasting-utils
Browse files Browse the repository at this point in the history
Issue/rm nowcasting utils
  • Loading branch information
peterdudfield authored Jan 30, 2024
2 parents 940e8f0 + 337abe5 commit 9732061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
11 changes: 4 additions & 7 deletions pvnet_summation/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
import torch
import torch.nn.functional as F
import wandb
from nowcasting_utils.models.loss import WeightedLosses
from nowcasting_utils.models.metrics import (
mae_each_forecast_horizon,
mse_each_forecast_horizon,
)
from pvnet.models.base_model import BaseModel as PVNetBaseModel
from pvnet.models.base_model import PVNetModelHubMixin
from pvnet.models.utils import (
MetricAccumulator,
PredAccumulator,
WeightedLosses,
)
from pvnet.optimizers import AbstractOptimizer

Expand Down Expand Up @@ -187,8 +183,9 @@ def validation_step(self, batch: dict, batch_idx):
"MSE/val": F.mse_loss(y_sum, y),
"MAE/val": F.l1_loss(y_sum, y),
}
mse_each_step = mse_each_forecast_horizon(output=y_sum, target=y)
mae_each_step = mae_each_forecast_horizon(output=y_sum, target=y)

mse_each_step = torch.mean((y_sum - y) ** 2, dim=0)
mae_each_step = torch.mean(torch.abs(y_sum - y), dim=0)
gsp_sum_losses.update({f"MSE_horizon/step_{i:02}": m for i, m in enumerate(mse_each_step)})
gsp_sum_losses.update({f"MAE_horizon/step_{i:02}": m for i, m in enumerate(mae_each_step)})

Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
nowcasting_utils
ocf_datapipes>=3.0.0
pvnet>=2.6.2
ocf_ml_metrics
ocf_datapipes==3.0.*
pvnet==2.6.*
ocf_ml_metrics==0.0.*
numpy
pandas
matplotlib
Expand Down

0 comments on commit 9732061

Please sign in to comment.