> ## 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.

# DataEncoderWorker.transform

**def DataEncoderWorker.transform**(self, data, test\_size=None) [\[source\]](https://github.com/aigensys-labs/aidflow/blob/main/AID/\TRUENAS\aig_modeling_Products\AID\1_0_Lib\AID\data\transform\data_encoder.py#L503)

Training phase utility for automatic feature encoding, preprocessing,
and train/test splits.

* Native Dtype Enforcement:
  * Converts datasets to native NumPy/Pandas dtypes to ensure full
    compatibility with LightGBM, XGBoost, and Scikit-Learn.
  * Prevents repeated N-step conversions during training, minimizing
    peak pipeline RAM footprint.

* Train/Test Partitioning:
  * Retains user-supplied `test_set` if explicitly provided.
  * Automatically splits `data` / train\_set by `test_size` if no
    test set is present.

* Feature Encoding Extension:
  * Extends train and test sets by WOE features given project-level
    fitted encoding (only if WoeEncoder was fitted during pipeline).

#### Parameters

**`data`** : *`pDF | pa.Table | DataEncoderInput`*
The raw or input-config data to be encoded for ML sampling.

**`test_size`** : *`float`*
Fraction of data allocated to the test set (used only when\
no explicit test set is provided).\
• None: uses value set during init\
• 0: returns test\_set = None - no data split

#### Returns

*`DataEncoderResult`*
An object containing synchronized train and test sets ready for agents.


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