<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLDataValue",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML11MLDataValueO"
  },
  "title" : "MLDataValue"
}
-->

# MLDataValue

The value of a cell in a data table.

```
enum MLDataValue
```

## Overview

The [`MLDataValue`](/documentation/CreateML/MLDataValue) enumeration is the fundamental type that you use to
store training data in a table. Classifiers use data values to store
information like evaluation metrics. Data values wrap all of the possible
data types you can use with Create ML.

To access the underlying information in a data value, you can use the
properties that correspond to the type’s enumeration cases. If you aren’t
sure which kind of value a data value wrapper contains, use a switch
statement to unwrap the value, or check the value of the
[`type`](/documentation/CreateML/MLDataValue/type) property.

## Topics

### Converting between types and data values

[`MLDataValueConvertible`](/documentation/CreateML/MLDataValueConvertible)

A type that can convert itself to and from a data value.

### Creating a data value

[`MLDataValue.int(_:)`](/documentation/CreateML/MLDataValue/int(_:))

An integer value.

[`MLDataValue.double(_:)`](/documentation/CreateML/MLDataValue/double(_:))

A double value.

[`MLDataValue.string(_:)`](/documentation/CreateML/MLDataValue/string(_:))

A string value.

[`MLDataValue.dictionary(_:)`](/documentation/CreateML/MLDataValue/dictionary(_:))

A dictionary of named data values.

[`MLDataValue.sequence(_:)`](/documentation/CreateML/MLDataValue/sequence(_:))

A sequence of data values.

[`MLDataValue.multiArray(_:)`](/documentation/CreateML/MLDataValue/multiArray(_:))

A multidimensional array of data values.

### Inspecting the type

[`type`](/documentation/CreateML/MLDataValue/type)

The kind of the underlying value that the data value wraps.

[`MLDataValue.ValueType`](/documentation/CreateML/MLDataValue/ValueType)

An enumeration describing the supported underlying types that an
`MLDataValue wraps`.

### Accessing numeric values

[`intValue`](/documentation/CreateML/MLDataValue/intValue)

The underlying integer value.

[`doubleValue`](/documentation/CreateML/MLDataValue/doubleValue)

The underlying double value.

### Accessing string values

[`stringValue`](/documentation/CreateML/MLDataValue/stringValue)

The underlying string value.

### Accessing dictionary values

[`dictionaryValue`](/documentation/CreateML/MLDataValue/dictionaryValue)

The underlying dictionary.

[`MLDataValue.DictionaryType`](/documentation/CreateML/MLDataValue/DictionaryType)

A dictionary of named data values.

### Accessing array values

[`sequenceValue`](/documentation/CreateML/MLDataValue/sequenceValue)

The underlying sequence.

[`MLDataValue.SequenceType`](/documentation/CreateML/MLDataValue/SequenceType)

A sequence of data values.

[`multiArrayValue`](/documentation/CreateML/MLDataValue/multiArrayValue)

The underlying multidimensional array.

[`MLDataValue.MultiArrayType`](/documentation/CreateML/MLDataValue/MultiArrayType)

A multidimensional array of data values.

### Comparing data values

[`==(_:_:)`](/documentation/CreateML/MLDataValue/==(_:_:))

Returns a Boolean value indicating whether two data values wrap the same
underlying value.

### Describing a data value

[`description`](/documentation/CreateML/MLDataValue/description)

A text representation of the data value.

[`debugDescription`](/documentation/CreateML/MLDataValue/debugDescription)

A text representation of the data value that’s suitable for output
during debugging.

### Handling errors

[`MLDataValue.invalid`](/documentation/CreateML/MLDataValue/invalid)

An invalid value.

[`isValid`](/documentation/CreateML/MLDataValue/isValid)

A Boolean value indicating whether the data value is valid.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)