ColumnConcatenator
A transformer that concatenates every numerical column in a dataframe into to a shaped array for each row.
Declaration
struct ColumnConcatenator<Scalar> where Scalar : MLShapedArrayScalar, Scalar : BinaryFloatingPointOverview
The resulting concatenated column contains MLShapedArray<Scalar> elements. For example
┏━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ ┃ label ┃ price ┃ rooms ┃ A ┃ B ┃ C ┃
┃ ┃ <String> ┃ <Int> ┃ <Int> ┃ <Int> ┃ <Int> ┃ <Int> ┃
┡━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ 0 │ good │ 850,000 │ 4 │ 1 │ 0 │ 0 │
│ 1 │ bad │ 700,000 │ 3 │ 0 │ 1 │ 0 │
│ 2 │ bad │ 650,000 │ 3 │ 0 │ 0 │ 1 │
│ 3 │ good │ 600,000 │ 2 │ 0 │ 1 │ 0 │
└───┴──────────┴─────────┴───────┴───────┴───────┴───────┘would be concatenated as:
┏━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃ label ┃ features ┃
┃ ┃ <String> ┃ <MLShapedArray<Float>> ┃
┡━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 0 │ good │ [850,000, 4, 1, 0, 0] │
│ 1 │ bad │ [700,000, 3, 0, 1, 0] │
│ 2 │ bad │ [650,000, 3, 0, 0, 1] │
│ 3 │ good │ [600,000, 2, 0, 1, 0] │
└───┴──────────┴────────────────────────┘Non-numerical columns are left in the data frame unchanged. Supported numeric types are Int, UInt8, Float, and Double. Arrays and shaped arrays of those types as supported, but every array in a given column must have the same shape and shaped arrays across columns must have the same shape except for the last dimension.