online_pomdp_planning.utils module

Utility functions that should have been provided by a standard library

class online_pomdp_planning.utils.MovingStatistic[source]

Bases: object

A moving average

Maintains average, min and max of a list of values online

add(val)[source]

Add a value to sequence that statistics are being maintained for

Parameters

val (float) – the new value

normalize(val)[source]

Normalizes val according to self statistics

Parameters

val – a value to be normalized

Return type

float

Returns

normalized value (between 0 and 1, if statistics are good)

online_pomdp_planning.utils.normalize_float(v, lower_bound, upper_bound)[source]

Normalizes v between lower_bound and upper_bound

Assumes (and will not check) that lower_bound <= v <= upper_bound

Parameters
  • v (float) – the value to be normalized

  • lower_bound (float) – the supposedly lowest possible value

  • upper_bound (float) – the supposedly highest possible value

Return type

float

Returns

normalized value (between 0 and 1)