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

# ECD Model Trainer Configuration Schema

> A detailed overview of the ECD model configuration, outlining each field and its purpose

Understanding the ECD model configuration is crucial for training effective models. This section breaks down each component of the configuration.

### Configuration Overview

The ECD model configuration consists of several key components:

```yaml theme={null}
model_type: ecd
input_features: []
output_features: []
combiner: {}
preprocessing: {}
trainer: {}
```

### Input Features

Input features define how your dataset columns are processed. Each feature is a dictionary with three fields:

* **name**: Field name used during model inference
* **type**: Feature type - supports the following types:
  * `binary` - Binary features (0/1, True/False)
  * `number` - Numerical/continuous features
  * `category` - Categorical features
  * `bag` - Bag-of-words features
  * `set` - Set features (unordered collections)
  * `sequence` - Sequence features (ordered lists)
  * `text` - Text features (natural language)
  * `vector` - Vector features (dense embeddings)
* **column**: Column name in your dataset

<Accordion title="Input Features Example">
  ```json theme={null}
  "input_features": [
    {
      "name": "device_name",
      "type": "category",
      "column": "device_name"
    },
    {
      "name": "hour_sin",
      "type": "numerical",
      "column": "hour_sin"
    }
  ]
  ```
</Accordion>

### Output Features

Output features define your model's prediction targets. You can specify multiple outputs with custom loss functions.

**Supported Output Feature Types:**

* `binary` - Binary classification (0/1, True/False)
* `number` - Regression/numerical predictions
* `category` - Multi-class classification
* `bag` - Bag-of-words predictions
* `set` - Set predictions (unordered collections)
* `sequence` - Sequence predictions (ordered lists)
* `text` - Text generation
* `vector` - Vector predictions (dense embeddings)

#### Example Configuration

```json theme={null}
"output_features": [
  {
    "loss": {
      "type": "binary_weighted_cross_entropy",
      "weight": 1,
      "class_weights": {
        "0": 0.66,
        "1": 2
      }
    },
    "name": "target",
    "type": "binary",
    "column": "target"
  }
]
```

#### Loss Configuration

For classification tasks, configure the loss function:

```json theme={null}
"loss": {
  "type": "softmax_cross_entropy",  // or "binary_weighted_cross_entropy"
  "class_weights": null,              // or {"0": 0.75, "1": 0.25}
  "weight": 1.0
}
```

**Parameters:**

* `class_weights` (default: `null`): Weights for each class. Use `null` for equal weighting
* `weight` (default: `1.0`): Overall loss weight for multi-task learning

### Combiner Configuration

The combiner merges features before making predictions. ECD uses the **TabNet** architecture.

#### Example Configuration

```json theme={null}
"combiner": {
  "type": "tabnet",
  "size": 64,
  "output_size": 64,
  "num_steps": 4,
  "num_total_blocks": 4,
  "num_shared_blocks": 2,
  "relaxation_factor": 1.3,
  "bn_epsilon": 0.001,
  "bn_momentum": 0.98,
  "bn_virtual_bs": 128,
  "sparsity": 0.001,
  "dropout": 0
}
```

#### TabNet Combiner Parameters

<AccordionGroup>
  <Accordion title="Architecture Parameters">
    * **size** (default: `32`): Hidden layer size (N\_a in TabNet paper)
    * **output\_size** (default: `128`): Fully connected layer output size (N\_d in TabNet paper)
    * **num\_steps** (default: `3`): Number of attention steps (N\_steps in TabNet paper)
    * **num\_total\_blocks** (default: `4`): Total feature transformer blocks per step
    * **num\_shared\_blocks** (default: `2`): Shared feature transformer blocks across steps
  </Accordion>

  <Accordion title="Regularization Parameters">
    * **dropout** (default: `0.05`): Dropout rate for transformer blocks
    * **sparsity** (default: `0.0001`): Sparsity loss multiplier (lambda\_sparse in TabNet paper)
    * **relaxation\_factor** (default: `1.5`): Feature reuse factor (gamma in TabNet paper)
      * Value of 1.0 means each feature used once
      * Higher values allow multiple feature usages
  </Accordion>

  <Accordion title="Batch Normalization">
    * **bn\_epsilon** (default: `0.001`): Epsilon added to batch norm denominator
    * **bn\_momentum** (default: `0.05`): Batch norm momentum (1 - m\_B from TabNet paper)
    * **bn\_virtual\_bs** (default: `128`): Virtual batch size for batch normalization
  </Accordion>
</AccordionGroup>

### Trainer Configuration

Configure the training process with optimization and validation settings.

<AccordionGroup>
  <Accordion title="Optimization Settings">
    * **optimizer**: `{"type": "adam"}` - Adam optimizer for gradient descent
    * **learning\_rate** (default: `0.001`): Initial learning rate
    * **learning\_rate\_scaling** (default: `"sqrt"`): LR scaling strategy
    * **decay** (default: `true`): Enable learning rate decay
    * **decay\_rate** (default: `0.8`): Rate of learning rate decay
    * **decay\_steps** (default: `20000`): Steps between decay applications
  </Accordion>

  <Accordion title="Training Parameters">
    * **epochs** (default: `100`): Maximum training epochs
    * **batch\_size** (default: `"auto"`): Batch size (auto-calculated or specify manually)
    * **early\_stop** (default: `10`): Stop if no improvement for N epochs
    * **validation\_field**: Field name to validate on (e.g., `"target"`)
    * **validation\_metric**: Metric for validation (e.g., `"roc_auc"`, `"accuracy"`)
  </Accordion>

  <Accordion title="Data Preprocessing">
    * **sample\_ratio**: Ratio of data to sample (e.g., `0.01` for 1%)
    * **sample\_size**: Absolute number of samples to use
    * **oversample\_minority**: Oversample minority class for imbalanced data
    * **undersample\_majority**: Undersample majority class
    * **split**: Configure train/validation/test split
      * `type`: `"stratify"` to maintain class distributions
      * `column`: Column to stratify on
      * `probabilities`: Split ratios (e.g., `[0.8, 0.1, 0.1]` for 80/10/10)
  </Accordion>
</AccordionGroup>

## Complete Configuration Example

Here's a complete end-to-end ECD model configuration for a binary classification task:

```json theme={null}
{
  "model_type": "ecd",
  "infra_type": "gpu",
  "trainer": {
    "early_stop": 5,
    "decay": true,
    "batch_size": 512,
    "epochs": 50,
    "optimizer": {
      "type": "adam"
    },
    "decay_rate": 0.8,
    "decay_steps": 20000,
    "learning_rate": 0.02,
    "validation_field": "target",
    "validation_metric": "roc_auc",
    "learning_rate_scaling": "sqrt"
  },
  "preprocessing": {
    "sample_ratio": 0.01,
    "sample_size": null,
    "oversample_minority": null,
    "undersample_majority": null,
    "global_max_sequence_length": null,
    "split": {
      "type": "stratify",
      "column": "target",
      "probabilities": [0.8, 0.1, 0.1]
    }
  },
  "combiner": {
    "type": "tabnet",
    "size": 64,
    "output_size": 64,
    "num_steps": 4,
    "num_total_blocks": 4,
    "num_shared_blocks": 2,
    "relaxation_factor": 1.3,
    "bn_epsilon": 0.001,
    "bn_momentum": 0.98,
    "bn_virtual_bs": 128,
    "sparsity": 0.001,
    "dropout": 0
  },
  "input_features": [
    {
      "name": "input_1",
      "type": "category",
      "column": "input_1"
    },
    {
      "name": "input_2",
      "type": "text",
      "column": "input_2"
    }
  ],
  "output_features": [
    {
      "name": "target",
      "type": "binary",
      "column": "target",
      "loss": {
        "type": "binary_weighted_cross_entropy",
        "class_weights": {
          "0": 0.66,
          "1": 2
        },
        "weight": 1
      }
    }
  ]
}
```

<Tip>
  **Quick Start Tips:**

  * Start with default parameters for your first training run
  * Adjust `class_weights` if you have imbalanced classes
  * Increase `num_steps` (3-7) for more complex feature interactions
  * Use `early_stop` to prevent overfitting
  * Set `sample_ratio` to a small value (0.01) for faster experimentation with large datasets
</Tip>

## Next Steps

After successfully training and deploying your ECD model:

<CardGroup cols="2">
  <Card title="Monitor Performance" icon="chart-line" href="/model-suite/deployments/inference-and-monitoring">
    Track your model's inference performance and usage metrics
  </Card>

  <Card title="Benchmarking" icon="gauge" href="/benchmarking/introduction">
    Evaluate your model's quality and performance against baselines
  </Card>

  <Card title="Optimization Guide" icon="bolt" href="/guides/optimization-guide">
    Learn techniques to improve model latency and throughput
  </Card>

  <Card title="API Integration" icon="code" href="/api-reference/introduction">
    Integrate your deployed model into your applications
  </Card>
</CardGroup>
