View source on GitHub
|
Two tower training and inference output computation.
tfm.uplift.layers.uplift_networks.two_tower_output_head.TwoTowerOutputHead(
treatment_indicator_feature_name: str,
uplift_network: base_uplift_networks.BaseTwoTowerUpliftNetwork,
inverse_link_fn: (Callable[[tf.Tensor], tf.Tensor] | None) = None,
**kwargs
)
This layer is intended to be used in conjunction with a two tower uplift network layer to compute training and inference outputs. It passes the input dictionary of feature tensors to the uplift network and computes training and inference tensors from the uplift network's outputs.
The control, treatment, and uplift predictions are computed from the uplift network's control and treatment logits. Additionally, if the treatment indicator tensor is part of the inputs, the true logits are also computed to be used for loss computation. The treatment indicator tensor should therefore be present in the inputs dictionary during training and evaluation.
Methods
call
call(
inputs: types.DictOfTensors,
training: (bool | None) = None,
mask: (tf.Tensor | None) = None
) -> (types.TwoTowerPredictionOutputs | types.TwoTowerTrainingOutputs)
Computes two tower inference and training outputs.
| Args | |
|---|---|
inputs
|
feature tensors to be passed to the uplift network. For training and evaluation, the treatment indicator tensor must be given as part of the inputs. |
training
|
optional boolean training flag to pass to the uplift network. |
mask
|
optional tensor mask to pass to the uplift network. |
| Returns | |
|---|---|
TwoTowerTrainingOutputs when the treatment indicator tensor is part of
the input features, otherwise TwoTowerPredictionOutputs.
|
View source on GitHub