> ## Documentation Index
> Fetch the complete documentation index at: https://aidflow.aigensys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent4PredictorWorker.fit

**def Agent4PredictorWorker.fit**(self, inputs, fx\_choice=REG.LGB, \*\*params) [\[source\]](https://github.com/aigensys-labs/aidflow/blob/main/AID/\TRUENAS\aig_modeling_Products\AID\1_0_Lib\AID\learner\agents\agent4_predictor.py#L459)

Train the GBM agent on numerical and/or categorical features.

Executes the full two-stage feature selection pipeline
(tree-based selection + shadow pruning), fits the final
GBM with early stopping, and computes validation
diagnostics.

#### Parameters

**`inputs`** : *`Agent4Input`*
Training configuration including train\_set,\
num\_features, and cat\_features.

**`fx_choice`** : *`str`*
The GBM engine: REG.LGB (LightGBM, default)\
or REG.XGB (XGBoost).

**`**params`** : *`dict`*
Runtime parameters passed to the internal fitter\
(gb\_max\_leaves, gb\_learning\_rate, gb\_estimators,\
gb\_min\_child\_weight, shadow\_quantile, cross\_val\_folds).

#### Returns

*`Agent4Predictor`*
The fitted agent instance.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.