Skip to content

← utilities package

OneHotCoding

Convert the given integer data to a one-hot coding.

This will create a new array with one dimension more than the input, where the new dimension is of size index_size. The output data will have a one in the location corresponding to the value of the input data, and zeros everywhere else. More Info... Version 1.0.0

Ports/Properties

data

Data to encode.

verbose name
Data
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
INOUT

index_size

Number of positions along the one-hot encoded axis. If not given, this defaults to the highest value in the data plus one; however, this can be brittle (if not all indices always occur), so it is recommended to set this value explicitly.

verbose name
Index Size
default value
None
port type
IntPort
value type
int (can be None)

precision

Numeric precision to use. Keep resolves to the precision of the template array if one is provided, and otherwise to the current default (usually 64-bit). Can be reduced to save memory (e.g. if running on GPU).

verbose name
Precision
default value
float32
port type
EnumPort
value type
str (can be None)

axis

Type of the new axis to append. This may also bake in a custom label, as in feature.mylabel.

verbose name
Axis
default value
statistic
port type
ComboPort
value type
str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)