<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLModel/prediction(from:using:)-97bu1",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "c:objc(cs)MLModel(im)predictionFromFeatures:usingState:error:"
  },
  "title" : "prediction(from:using:)"
}
-->

# prediction(from:using:)

Run a stateful prediction synchronously.

```
func prediction(from inputFeatures: any MLFeatureProvider, using state: MLState) throws -> any MLFeatureProvider
```

## Discussion

Use this method to run predictions on a stateful model.

```swift
let state = model.newState()
let prediction = try model.prediction(from: inputFeatures, using: state)
```

- inputFeatures: The input features as declared in the model description.
- state: The state object created by `newState()` method.
- error: The output parameter to receive an error information on failure.

---

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)