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)



View source

See Scorer.