citylearn.dynamics module

class citylearn.dynamics.Dynamics[source]

Bases: object

Base building dynamics model.

reset()[source]
class citylearn.dynamics.LSTMDynamics(filepath: Path | str, input_observation_names: List[str], input_normalization_minimum: List[float], input_normalization_maximum: List[float], hidden_size: int, num_layers: int, lookback: int, input_size: int = None, dropout: float = None)[source]

Bases: Dynamics, Module

LSTM building dynamics model that predicts indoor temperature based on partial cooling/heating load and other weather variables.

Parameters:
  • filepath (Union[Path, str]) – Path to model state dictionary.

  • input_observation_names (List[str]) – List of maximum values used for input observation min-max normalization.

  • input_normalization_minimum (List[float]) – List of minumum values used for input observation min-max normalization.

  • input_normalization_maximum (List[float]) – List of maximum values used for input observation min-max normalization.

  • hidden_size (int) – The number of neurons in hidden layer.

  • num_layers (int) – Number of hidden layers.

  • lookback (int) – Number of samples used for prediction.

  • input_size (int, optional) – Number of variables used for prediction. This may not equal input_observation_names e.g. cooling and heating demand may be included in input_observation_names but only one of two may be used for the actual prediction depending on building needs. The default is to set set input_size to the length of input_observation_names.

  • dropout (float, default: 0.0) – Probability of excluding input and recurrent connections to LSTM units from activation and weight updates while training a network. This has the effect of reducing overfitting and improving model performance.

forward(x, h)[source]

Predict indoor dry bulb temperature.

init_hidden(batch_size: int)[source]

Initialize hidden states.

property input_size: int
reset()[source]

Loads dynamic model state dict, and initializes hidden states and model input.

set_linear() Linear[source]

Initialize linear transformer.

set_lstm() LSTM[source]

Initialize LSTM model.

terminate()[source]