PVNet 5.3.22__tar.gz → 5.3.24__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {pvnet-5.3.22 → pvnet-5.3.24}/PKG-INFO +1 -1
  2. {pvnet-5.3.22 → pvnet-5.3.24}/PVNet.egg-info/PKG-INFO +1 -1
  3. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/training/lightning_module.py +26 -1
  4. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/training/plots.py +23 -5
  5. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/training/train.py +2 -1
  6. {pvnet-5.3.22 → pvnet-5.3.24}/LICENSE +0 -0
  7. {pvnet-5.3.22 → pvnet-5.3.24}/PVNet.egg-info/SOURCES.txt +0 -0
  8. {pvnet-5.3.22 → pvnet-5.3.24}/PVNet.egg-info/dependency_links.txt +0 -0
  9. {pvnet-5.3.22 → pvnet-5.3.24}/PVNet.egg-info/requires.txt +0 -0
  10. {pvnet-5.3.22 → pvnet-5.3.24}/PVNet.egg-info/top_level.txt +0 -0
  11. {pvnet-5.3.22 → pvnet-5.3.24}/README.md +0 -0
  12. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/__init__.py +0 -0
  13. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/datamodule.py +0 -0
  14. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/load_model.py +0 -0
  15. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/__init__.py +0 -0
  16. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/base_model.py +0 -0
  17. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/ensemble.py +0 -0
  18. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/__init__.py +0 -0
  19. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/basic_blocks.py +0 -0
  20. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/encoders/__init__.py +0 -0
  21. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/encoders/basic_blocks.py +0 -0
  22. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/encoders/encoders3d.py +0 -0
  23. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/late_fusion.py +0 -0
  24. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/linear_networks/__init__.py +0 -0
  25. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/linear_networks/basic_blocks.py +0 -0
  26. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/linear_networks/networks.py +0 -0
  27. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/site_encoders/__init__.py +0 -0
  28. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/site_encoders/basic_blocks.py +0 -0
  29. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/models/late_fusion/site_encoders/encoders.py +0 -0
  30. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/optimizers.py +0 -0
  31. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/training/__init__.py +0 -0
  32. {pvnet-5.3.22 → pvnet-5.3.24}/pvnet/utils.py +0 -0
  33. {pvnet-5.3.22 → pvnet-5.3.24}/pyproject.toml +0 -0
  34. {pvnet-5.3.22 → pvnet-5.3.24}/setup.cfg +0 -0
  35. {pvnet-5.3.22 → pvnet-5.3.24}/tests/test_datamodule.py +0 -0
  36. {pvnet-5.3.22 → pvnet-5.3.24}/tests/test_end2end.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 5.3.22
3
+ Version: 5.3.24
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Requires-Python: <3.14,>=3.11
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PVNet
3
- Version: 5.3.22
3
+ Version: 5.3.24
4
4
  Summary: PVNet
5
5
  Author-email: Peter Dudfield <info@openclimatefix.org>
6
6
  Requires-Python: <3.14,>=3.11
@@ -129,11 +129,15 @@ class PVNetLightningModule(pl.LightningModule):
129
129
  if self.model.use_quantile_regression:
130
130
  metric_name = "val_fraction_below/fraction_below_{:.2f}_quantile"
131
131
  # Add fraction below each quantile for calibration
132
+ val_quantiles = np.zeros(len(self.model.output_quantiles))
132
133
  for i, quantile in enumerate(self.model.output_quantiles):
133
134
  below_quant = y <= y_hat[..., i]
134
135
  # Mask values small values, which are dominated by night
135
136
  mask = y >= 0.01
136
- losses[metric_name.format(quantile)] = below_quant[mask].float().mean()
137
+ below_quant_masked_mean = below_quant[mask].float().mean()
138
+ losses[metric_name.format(quantile)] = below_quant_masked_mean
139
+ val_quantiles[i] = below_quant_masked_mean
140
+ self._val_quantiles.append(val_quantiles)
137
141
 
138
142
  return losses
139
143
 
@@ -185,6 +189,8 @@ class PVNetLightningModule(pl.LightningModule):
185
189
  # Set up stores which we will fill during validation
186
190
  self.all_val_results: list[xr.Dataset] = []
187
191
  self._val_horizon_maes: list[np.array] = []
192
+ if self.model.use_quantile_regression:
193
+ self._val_quantiles: list[np.array] = []
188
194
  if self.current_epoch == 0:
189
195
  self._val_persistence_horizon_maes: list[np.array] = []
190
196
 
@@ -355,6 +361,25 @@ class PVNetLightningModule(pl.LightningModule):
355
361
  step=self.trainer.global_step,
356
362
  )
357
363
 
364
+ # Create a quantile-quantile plot
365
+ if self.model.use_quantile_regression:
366
+ val_quantiles = np.mean(self._val_quantiles, axis=0)
367
+ self._val_quantiles = []
368
+
369
+ qq_plot = wandb_line_plot(
370
+ x=self.model.output_quantiles,
371
+ y=val_quantiles,
372
+ xlabel="Target quantile",
373
+ ylabel="Fraction below quantile",
374
+ title="Quantile-quantile plot",
375
+ add_identity_line=True
376
+ )
377
+
378
+ wandb.log(
379
+ {"quantile_quantile": qq_plot},
380
+ step=self.trainer.global_step,
381
+ )
382
+
358
383
  # Create persistence horizon accuracy curve but only on first epoch
359
384
  if self.current_epoch == 0:
360
385
  persist_horizon_mae_plot = wandb_line_plot(
@@ -14,13 +14,31 @@ def wandb_line_plot(
14
14
  y: Sequence[float],
15
15
  xlabel: str,
16
16
  ylabel: str,
17
- title: str | None = None
17
+ title: str | None = None,
18
+ add_identity_line: bool = False,
18
19
  ) -> wandb.plot.CustomChart:
19
20
  """Make a wandb line plot"""
20
- data = [[xi, yi] for (xi, yi) in zip(x, y)]
21
- table = wandb.Table(data=data, columns=[xlabel, ylabel])
22
- return wandb.plot.line(table, xlabel, ylabel, title=title)
23
-
21
+ # Main series data
22
+ data = [[xi, yi, "model"] for xi, yi in zip(x, y)]
23
+
24
+ # Add identity line endpoints if requested
25
+ if add_identity_line:
26
+ min_val, max_val = min(x), max(x)
27
+ data.append([min_val, min_val, "y=x"])
28
+ data.append([max_val, max_val, "y=x"])
29
+
30
+ table = wandb.Table(data=data, columns=[xlabel, ylabel, "key"])
31
+
32
+ # stroke=None creates a clean single line; stroke="key" creates multi-line legend
33
+ stroke_col = "key" if add_identity_line else None
34
+
35
+ return wandb.plot.line(
36
+ table=table,
37
+ x=xlabel,
38
+ y=ylabel,
39
+ stroke=stroke_col,
40
+ title=title
41
+ )
24
42
 
25
43
  def plot_sample_forecasts(
26
44
  batch: TensorBatch,
@@ -119,4 +119,5 @@ def train(config: DictConfig) -> None:
119
119
  )
120
120
 
121
121
  # Train the model completely
122
- trainer.fit(model=model, datamodule=datamodule)
122
+ trainer.fit(model=model, datamodule=datamodule,
123
+ ckpt_path=config.ckpt_path if 'ckpt_path' in config else None)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes