---
title: "fitted(to:eventHandler:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/onehotencoder/fitted(to:eventhandler:)"
---

# fitted(to:eventHandler:)

Fits a one-hot encoder to a sequence of categories.

## Declaration

```swift
func fitted<S>(to input: S, eventHandler: EventHandler? = nil) throws -> OneHotEncoder<Category>.Transformer where S : Sequence, S.Element == Category?
```

## Parameters

- `input`: A sequence of categories.
- `eventHandler`: An event handler.

## Return Value

Return Value The fitted transformer.
