analysis_prep v0.1.2 AnalysisPrep.Encode

Encode series with one-hot or label encoding.

Summary

Functions

Produce a label encoding, a sorted set of known labels, returning the index of that label

Produce a hot key encoding, a column for every value with a 0 or 1 in each cell

Functions

label(list)
label(list) :: list

Produce a label encoding, a sorted set of known labels, returning the index of that label.

Examples:

iex> label ["b", "a", "b", "c"]
[1,0,1,2]

iex> label []
[]
one_hot(list)
one_hot(list) :: list

Produce a hot key encoding, a column for every value with a 0 or 1 in each cell.

Examples:

iex> one_hot ["a", "b", "a"]
[["a", "b"], [1,0], [0,1], [1,0]]

iex> one_hot []
[]