Class

MLSequence

A sequence of data used as a feature input or feature output for a model.

Declaration

class MLSequence : NSObject

Overview

Data from sensors (a time series) or language (a series of words) are often manipulated as sequences by machine learning models. These sequences can have variable lengths depending on their context. MLSequence explicitly encodes a sequence of strings or integers to support a series of data points as a single input.

If you need to process a sequence of values individually, one at a time, see Making Predictions with a Sequence of Inputs for details.

Topics

Creating a Sequence

init(int64s: [NSNumber])

Creates a sequence from an array of integers.

init(strings: [String])

Creates a sequence from an array of strings.

init(empty: MLFeatureType)

Creates an empty sequence of the given type.

Accessing Values

var int64Values: [NSNumber]

The integer elements of the sequence.

var stringValues: [String]

The string elements of the sequence.

Inspecting the Sequence

var type: MLFeatureType

The type of value held in the sequence.

Relationships

Inherits From

Conforms To

See Also

Accessing the Value

var isUndefined: Bool

A Boolean value indicating whether the feature value is undefined.

var int64Value: Int64

The integer wrapped in this feature value.

var doubleValue: Double

The double wrapped in this feature value.

var stringValue: String

The string wrapped in this feature value.

var dictionaryValue: [AnyHashable : NSNumber]

The dictionary wrapped in this feature value.

var imageBufferValue: CVPixelBuffer?

The image, or pixelBuffer, wrapped in this feature value.

var multiArrayValue: MLMultiArray?

The multidimensional array wrapped in this feature value.

class MLMultiArray

A multidimensional array used as a feature input or feature output for a model.

var sequenceValue: MLSequence?

The sequence wrapped in this feature value.