---
title: "encodeWithOptimizer(_:to:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/updatabletemporalestimatortosupervisedadaptor/encodewithoptimizer(_:to:)"
---

# encodeWithOptimizer(_:to:)

Encodes the transformer and optimizer to an encoder.

## Declaration

```swift
func encodeWithOptimizer(_ transformer: UpdatableTemporalEstimatorToSupervisedAdaptor<Estimator, Annotation>.Transformer, to encoder: inout any EstimatorEncoder) throws
```

## Parameters

- `transformer`: A transformer this estimator creates.
- `encoder`: An encoder.

## See Also

### Encoding and decoding

- [encode(_:to:)](createmlcomponents/updatabletemporalestimatortosupervisedadaptor/encode(_:to:).md)
- [decode(from:)](createmlcomponents/updatabletemporalestimatortosupervisedadaptor/decode(from:).md)
- [decodeWithOptimizer(from:)](createmlcomponents/updatabletemporalestimatortosupervisedadaptor/decodewithoptimizer(from:).md)
