Skip to content

model_configs

pytorch_lattice.model_configs

Model configurations classes for PyTorch Calibrated Models.

LatticeConfig dataclass

Bases: _BaseModelConfig

Configuration for a calibrated lattice model.

Attributes:

Name Type Description
All

_BaseModelConfig attributes.

kernel_init LatticeInit

The LatticeInit scheme to use to initialize the lattice kernel.

interpolation Interpolation

The Interpolation scheme to use in the lattice. Note that HYPERCUBE has exponential time complexity while SIMPLEX has log-linear time complexity.

Source code in pytorch_lattice/model_configs.py
@dataclass
class LatticeConfig(_BaseModelConfig):
    """Configuration for a calibrated lattice model.

    Attributes:
        All: `_BaseModelConfig` attributes.
        kernel_init: The `LatticeInit` scheme to use to initialize the lattice kernel.
        interpolation: The `Interpolation` scheme to use in the lattice. Note that
            `HYPERCUBE` has exponential time complexity while `SIMPLEX` has
            log-linear time complexity.
    """

    kernel_init: LatticeInit = LatticeInit.LINEAR
    interpolation: Interpolation = Interpolation.SIMPLEX

LinearConfig dataclass

Bases: _BaseModelConfig

Configuration for a calibrated linear model.

Attributes:

Name Type Description
All

_BaseModelConfig attributes.

use_bias bool

Whether to use a bias term for the linear combination.

Source code in pytorch_lattice/model_configs.py
@dataclass
class LinearConfig(_BaseModelConfig):
    """Configuration for a calibrated linear model.

    Attributes:
        All: `_BaseModelConfig` attributes.
        use_bias: Whether to use a bias term for the linear combination.
    """

    use_bias: bool = True