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

Add time features to multimodal.py #240

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pvnet/models/multimodal/multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(
add_image_embedding_channel: bool = False,
include_gsp_yield_history: bool = True,
include_sun: bool = True,
include_time: bool = False,
embedding_dim: Optional[int] = 16,
forecast_minutes: int = 30,
history_minutes: int = 60,
Expand Down Expand Up @@ -97,6 +98,7 @@ def __init__(
embedding of the GSP ID.
include_gsp_yield_history: Include GSP yield data.
include_sun: Include sun azimuth and altitude data.
include_time: Include sine and cosine of dates and times.
embedding_dim: Number of embedding dimensions to use for GSP ID. Not included if set to
`None`.
forecast_minutes: The amount of minutes that should be forecasted.
Expand Down Expand Up @@ -141,6 +143,7 @@ def __init__(
self.include_nwp = nwp_encoders_dict is not None and len(nwp_encoders_dict) != 0
self.include_pv = pv_encoder is not None
self.include_sun = include_sun
self.include_time = include_time
self.include_wind = wind_encoder is not None
self.include_sensor = sensor_encoder is not None
self.embedding_dim = embedding_dim
Expand Down Expand Up @@ -283,6 +286,16 @@ def __init__(
# Update num features
fusion_input_features += 16

if self.include_time:
self.time_fc1 = nn.Linear(
in_features=4
* (self.forecast_len + self.forecast_len_ignore + self.history_len + 1),
out_features=32,
)

# Update num features
fusion_input_features += 32

if include_gsp_yield_history:
# Update num features
fusion_input_features += self.history_len
Expand Down
Loading