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

# Predictor

> AID.predictor.predictor.Predictor

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
from AID.predictor.predictor import Predictor
```

Inference Engine — Production Scoring API.

The primary user-facing interface for applying trained AIDflow
pipelines to new data. Provides access to every pipeline stage
(cleaning, encoding, agent prediction) using the exact
parameters locked during training.

> `Applicable for projects with stored (save=1) models only.`

#### What It Does

* *`Loads`* all trained models from a project's storage.
* *`Preprocesses`* input data through the full pipeline
  using trained standards.
* *`Predicts`* with any trained agent or the champion
  production model.
* *`Exposes`* intermediate stages for diagnostic or
  custom-chain use.

#### Pipeline Stages Available

1. **Data Quality**: `fe_clean` — type/quality/relevance
   validation against trained standards.
2. **Stability**: `fe_stabilize`, `obs_stabilize` —
   time-stability filtering and outlier labeling.
3. **Encoding**: `num_encode`, `cat_encode`,
   `ixn_encode`, `woe_encode`, `woe_stabilize`,
   `data_encode` — full feature transformation pipeline.
4. **Prediction**: `agent1_predict` … `agent4_predict`,
   `champion_predict` — model inference.

#### Two Usage Modes

* **preprocess=True** (default): Pass original input columns.
  The full preprocessing pipeline is applied automatically.
* **preprocess=False**: Pass pre-encoded data (e.g., WOE
  features). Skips preprocessing — useful for chaining
  stages or when encoding is applied externally.

#### Parameters

**`project`** : *`str | Parameters`*
Base training project. Accepts a project name (str) or\
a `Parameters` object. Defines which trained models\
are loaded for inference.

**`path`** : *`str`*
Alternative project setup path for comparison. Must\
reside within the base project's `2_Output` folder.

> [!NOTE]
>
> **Training-Serving Symmetry**:
>
> * Every transformation uses the parameters locked during training
>   (binning thresholds, imputation values, encoding maps, stability filters).
> * No statistics are re-derived at inference time.
>
> **Chainable Stages**:
>
> * Individual stages (`fe_clean`, `woe_encode`, etc.) can be called
>   independently to inspect intermediate results or build custom pipelines.
>
> **Champion vs. Agents**:
>
> * The `champion_predict` method applies the production model
>   (selected during the Selection stage).
> * Individual agent predictions (`agent1_predict` … `agent4_predict`)
>   are available for comparison or monitoring.

#### Examples

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
from aidflow.predictor import Predictor
pred = Predictor(project='my_project')

# Full pipeline prediction (raw data in, probability out)
result = pred.champion_predict(new_raw_data, preprocess=True)
result.data  # P(class=1) probabilities

# Individual agent for comparison
a1 = pred.agent1_predict(new_raw_data, preprocess=True)
a2 = pred.agent2_predict(new_raw_data, preprocess=True)
```


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