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

# fitted(to:validateOn:eventHandler:)

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

## Declaration

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

## Parameters

- `input`: A data frame containing examples used for fitting the transformer.
- `validation`: A data frame containing examples used for validating the fitted transformer.
- `eventHandler`: An event handler. This method reports maximum error and root-mean-square error metrics.

## Return Value

Return Value The fitted boosted tree regressor model.

## See Also

### Fitting a regressor model

- [BoostedTreeRegressor.Transformer](createmlcomponents/boostedtreeregressor/transformer.md)
