Nominal#

Nominal(target=None, magnitude=1, bits=None)[source]#

Converts a target value to a binary representation using a specified number of bits.

Parameters:
targetint or numpy.ndarray

The target value(s) to be converted.

magnitudefloat

The magnitude of the binary representation, usually reward magnitude for cases with multiple possible outcomes.

bitsint

The number of possible values to use for determining the length of the binary representation.

Returns:
numpy.ndarray:

The binary representation of the target value(s).

Raises:
ValueError:

If the number of bits is less than the maximum stimulus value.

ValueError:

If the number of bits is 0 and the target value is less than 1.