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

# encodeWithOptimizer(_:to:)

Encodes the transformer and optimizer to an encoder.

## Declaration

```swift
func encodeWithOptimizer(_ transformer: UpdatableSupervisedEstimatorToTemporalAdaptor<Base>.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/updatablesupervisedestimatortotemporaladaptor/encode(_:to:).md)
- [decode(from:)](createmlcomponents/updatablesupervisedestimatortotemporaladaptor/decode(from:).md)
- [decodeWithOptimizer(from:)](createmlcomponents/updatablesupervisedestimatortotemporaladaptor/decodewithoptimizer(from:).md)
