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

# fitted(to:validateOn:eventHandler:)

Fits a boosted tree classifier model to a collection of examples.

## Declaration

```swift
func fitted(to input: DataFrame, validateOn validation: DataFrame? = nil, eventHandler: EventHandler? = nil) async throws -> TreeClassifierModel<Label>
```

## Parameters

- `input`: A data frame of examples.
- `validation`: A data frame of validation examples.
- `eventHandler`: An event handler. This method reports accuracy and loss metrics.

## Return Value

Return Value The fitted boosted tree classifier model.

## See Also

### Fitting the classifier

- [BoostedTreeClassifier.Annotation](createmlcomponents/boostedtreeclassifier/annotation.md)
- [BoostedTreeClassifier.Transformer](createmlcomponents/boostedtreeclassifier/transformer.md)
