tfm.uplift.layers.uplift_networks.two_tower_output_head.TwoTowerOutputHead
Stay organized with collections
Save and categorize content based on your preferences.
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.
Args |
treatment_indicator_feature_name
|
the name of the feature representing the
treatment indicator tensor, which should be castable to a boolean tensor
(False for control and True for treatment). When this tensor is part of
the layer inputs, additional true logits are returned for the loss
computation. In this case the layer returns a TwoTowerTrainingOutputs
instance, otherwise a TwoTowerPredictionOutputs instance is returned.
|
uplift_network
|
a layer for computing control and treatment logits. Its
input is expected to be a dictionary of feature tensors and its output
is exptected to be a TwoTowerNetworkOutputs instance.
|
inverse_link_fn
|
a function for computing the control and treatment
predictions from their respective logits. If left as None it is
functionally equivalent to the idendity function.
|
**kwargs
|
base layer keyword arguments.
|
Methods
call
View source
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-11-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-11-06 UTC."],[],[]]