citylearn.preprocessing module
- class citylearn.preprocessing.Normalize(x_min: Union[float, int], x_max: Union[float, int])[source]
- class citylearn.preprocessing.OnehotEncoding(classes: Union[List[float], List[int], List[str]])[source]
Bases:
citylearn.preprocessing.Encoder
Initialize PeriodicNormalization encoder class.
Use to transform unordered categorical observations e.g. boolean daylight savings e.t.c.
- Parameters
classes (Union[List[float], List[int], List[str]]) – Observation categories.
Examples
>>> classes = [1, 2, 3, 4] >>> encoder = OnehotEncoding(classes) # identity_matrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] >>> observation = 2 >>> encoder*observation [0, 1, 0, 0]