Generic Initializer

init(column:)

Creates a new column of machine learning sequences from a given column whose elements can be converted to sequences.

Declaration

init<T>(column: MLDataColumn<T>) where T : MLDataValueConvertible
Available when Element is MLDataValue.SequenceType.

Parameters

column

An MLDataColumn of elements convertible to MLDataValue.SequenceType.

Discussion

Use this initializer to create a column of sequences from another column. Start by creating a column that is convertible to a column of sequences.

let intSequenceString = "[1, 2, 3]"
let intSequenceString2 = "[4, 5, 6]"
let stringsColumn = MLDataColumn([intSequenceString, intSequenceString2])

print(stringsColumn)
// Prints "[1, 2, 3]", "[4, 5, 6]"]

Then use init(column:) to convert the column to a column of sequences.

let sequenceColumn = MLDataColumn<MLDataValue.SequenceType>(column: stringsColumn)
print(sequenceColumn)
// Prints [[DataValue(1), DataValue(2), DataValue(3)],
//         [DataValue(4), DataValue(5), DataValue(6)]]

See Also

Creating a Data Column by Converting Another Column

func map<T>(to: T.Type) -> MLDataColumn<T>

Creates a new column by converting this column to the given type.

init<T>(column: MLDataColumn<T>)

Creates a new column of integers from a given column whose elements can be converted to integers.

init<T>(column: MLDataColumn<T>)

Creates a new column of arrays of integers from a given column whose elements can be converted to an array of integers.

init<T>(column: MLDataColumn<T>)

Creates a new column of doubles from a given column whose elements can be converted to doubles.

init<T>(column: MLDataColumn<T>)

Creates a new column of arrays of doubles from a given column whose elements can be converted to an array of doubles.

init<T>(column: MLDataColumn<T>)

Creates a new column of strings from a given column whose elements can be converted to strings.

init<T>(column: MLDataColumn<T>)

Creates a new column of arrays of strings from a given column whose elements can be converted to an array of strings.

init<T>(column: MLDataColumn<T>)

Creates a new column of machine learning dictionaries from a given column whose elements can be converted to dictionaries.