sustaingym.envs.building.stochastic_generator
#
Module Contents#
Classes#
A generator class for the uncontrollable features in BuildingEnv. |
- class sustaingym.envs.building.stochastic_generator.StochasticUncontrollableGenerator(block_size: int)[source]#
A generator class for the uncontrollable features in BuildingEnv.
- Parameters:
block_size (int) –
- split_observations_into_seasons(data: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray] [source]#
Splits observation data into summer and winter seasons.
- Parameters:
data (numpy.ndarray) – Observation data, shape [n, num_features]. Assumed to represent a whole year of observations.
- Returns:
summer_observations – Summer ambient features. Shape is (len_of_season, num_features).
winter_observations – Winter ambient features. Shape is (len_of_season, num_features).
- Raises:
ValueError if no data is given and the class instance – has no observations stored.
- Return type:
tuple[numpy.ndarray, numpy.ndarray]
- get_empirical_dist(season: str | None = None, this_season_observations: numpy.ndarray | None = None, block_size: int | None = None) list[scipy.stats.rv_continuous] [source]#
Fits a multivariate normal distribution to each ambient feature.
- Parameters:
season (str | None) – The desired season. Can be
None
if this_season_observations is not None. Otherwise, can besummer
orwinter
if data has been generated and split into seasons through split_observations_into_seasons.this_season_observations (numpy.ndarray | None) – The observation data for this season. Can be
None
if user has generated and split data.block_size (int | None) – Desired block size for each ambient feature vector, defaults to self.block_size
- Returns:
empirical_dists – list of length num_features, empirical distributions for each of the ambient features, each distribution is a multivariate normal with shape [block_size]
- Raises:
ValueError if neither season nor this_season_observations is specified OR – if the season is given but it is not “summer” or “winter”
- Return type:
list[scipy.stats.rv_continuous]
- draw_samples_from_dist(num_samples: int, summer_frac: float, dists: collections.abc.Iterable[scipy.stats.rv_continuous] | None = None, block_size: int | None = None) numpy.ndarray [source]#
Draw vector samples from fitted multivariate Gaussian.
- Parameters:
num_samples (int) – The number of desired samples.
summer_frac (float) – The weight of the generated observations to be given to those generated from the summer distribution.
dists (collections.abc.Iterable[scipy.stats.rv_continuous] | None) – Iterable of the empirical distributions. Can be
None
if instance has generated empirical distributions through get_empirical_dist.block_size (int | None) –
- Returns:
samples – The samples generated from the fitted distributions. Shape is (num_samples x block_size, num_obs_features).
- Raises:
ValueError if summer_frac is not between 0 and 1 or if – either the summer or winter distributions aren’t available to draw samples from.
- Return type:
numpy.ndarray