LP_regularizer

class ampligraph.latent_features.LP_regularizer(trainable_param, regularizer_parameters={})

Norm \(L^{p}\) regularizer.

It is passed to the model as the entity_relation_regularizer argument of the compile() method.

Parameters:
  • trainable_param (tf.Variable) – Trainable parameters of the model that need to be regularized.

  • regularizer_parameters (dict) –

    Parameters of the regularizer:

    • p: (int) - p for the LP regularizer. For example, when \(p=2\) (default), it uses the L2 regularizer.

    • lambda : (float) - Regularizer weight (default: 0.00001).

Returns:

regularizer – Regularizer instance from the tf.keras.regularizer class.

Return type:

tf.keras.regularizer