Label Encoding
Question: Label Encoding is the method of converting label (categorical) data to numeric data via enumeration. We do this by enumerating the labels, replacing them with numbers starting from 0. Define a function 'lblenc' that takes in a table and symbol column name, and returns the table with the column converted to an integer list (type 7h). The function should encode all symbols as integers, and encoding should start at 0.
More Information:
https://www.geeksforgeeks.org/ml-label-encoding-of-datasets-in-python/Example
q)show shirts:([]sku:0 0 0 0 1 1;size:`s`s`s`s`l`xl;color:`red`blue`yellow`green`white`black;price:29.95 29.95 29.95 29.95 14.99 14.99)
sku size color price
---------------------
0 s red 29.95
0 s blue 29.95
0 s yellow 29.95
0 s green 29.95
1 l white 14.99
1 xl black 14.99
q)lblenc[shirts;`size] // encode one feature
sku size color price
---------------------
0 0 red 29.95
0 0 blue 29.95
0 0 yellow 29.95
0 0 green 29.95
1 1 white 14.99
1 2 black 14.99
q)lblenc/[shirts;`size`color] // encode multiple features
sku size color price
--------------------
0 0 0 29.95
0 0 1 29.95
0 0 2 29.95
0 0 3 29.95
1 1 4 14.99
1 2 5 14.99