---
title: "prediction(from:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mltextclassifier/prediction(from:)"
---

# prediction(from:)

Classifies a string with a label.

## Declaration

```swift
func prediction(from text: String) throws -> String
```

## Parameters

- `text`: The string to be classified.

## Return Value

Return Value The label for the given string.

## See Also

### Testing a text classifier

- [predictions(from:)](createml/mltextclassifier/predictions(from:).md)
- [predictionWithConfidence(from:)](createml/mltextclassifier/predictionwithconfidence(from:).md)
- [predictionsWithConfidence(from:)](createml/mltextclassifier/predictionswithconfidence(from:).md)
