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

# encodeWithOptimizer(_:to:)

Encodes the model and optimizer to an encoder.

## Declaration

```swift
func encodeWithOptimizer(_ transformer: TimeSeriesClassifier<Scalar, Label>.Transformer, to encoder: inout any EstimatorEncoder) throws
```
