CalibrationLayer

class ampligraph.latent_features.layers.calibration.CalibrationLayer(*args, **kwargs)

Layer to calibrate the model outputs.

The class implements the heuristics described in [TC20], using Platt scaling [P+99].

See the docs of calibrate() for more details.

Attributes

Methods

__init__([pos_size, neg_size, ...])

build(input_shape)

Build method.

call(scores_pos[, scores_neg, training])

Call method.

get_config()

Returns the config of the layer.

__init__(pos_size=0, neg_size=0, positive_base_rate=None, **kwargs)
build(input_shape)

Build method.

call(scores_pos, scores_neg=<tf.Tensor: shape=(0, ), dtype=float32, numpy=array([], dtype=float32)>, training=0)

Call method.

get_config()

Returns the config of the layer.

A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration.

The config of a layer does not include connectivity information, nor the layer class name. These are handled by Network (one layer of abstraction above).

Note that get_config() does not guarantee to return a fresh copy of dict every time it is called. The callers should make a copy of the returned dict if they want to modify it.

Returns:

Python dictionary.