Skip to main content
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:
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
"input_features": [
  {
    "name": "device_name",
    "type": "category",
    "column": "device_name"
  },
  {
    "name": "hour_sin",
    "type": "numerical",
    "column": "hour_sin"
  }
]

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

"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:
"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

"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

  • 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
  • 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
  • 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

Trainer Configuration

Configure the training process with optimization and validation 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
  • 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")
  • 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)

Complete Configuration Example

Here’s a complete end-to-end ECD model configuration for a binary classification task:
{
  "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
      }
    }
  ]
}
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

Next Steps

After successfully training and deploying your ECD model: