View source on GitHub |
Interface for univariate scorer.
Inherits From: Scorer
The UnivariateScorer
class is an abstract class to implement score
in
ModelBuilder
in tfr.keras with a univariate scoring function.
To be implemented by subclasses:
_score_flattened()
: Contains the logic to do the univariate scoring on flattened context and example features.
Example subclass implementation:
class SimpleUnivariateScorer(UnivariateScorer):
def _score_flattened(self, context_features, example_features):
x = tf.concat([tensor for tensor in example_features.values()], -1)
return tf.keras.layers.Dense(1)(x)
Methods
__call__
__call__(
context_features: tfr.keras.model.TensorDict
,
example_features: tfr.keras.model.TensorDict
,
mask: tf.Tensor
) -> Union[tf.Tensor, tfr.keras.model.TensorDict
]
See Scorer
.