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

# encodeWithOptimizer(_:to:)

Encodes a fitted transformer with an optimizer.

## Declaration

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

## Parameters

- `transformer`: A fully-connected network multi-label classifier model.
- `encoder`: An encoder for the estimator.
