# LPRegularizer¶

class ampligraph.latent_features.LPRegularizer(regularizer_params=None, verbose=False)

Performs LP regularization

$\mathcal{L}(Reg) = \sum_{i=1}^{n} \lambda_i * \mid w_i \mid_p$

where n is the number of model parameters, $$p \in{1,2,3}$$ is the p-norm and $$\lambda$$ is the regularization weight.

For example, if $$p=1$$ the function will perform L1 regularization. L2 regularization is obtained with $$p=2$$.

The nuclear 3-norm proposed in the ComplEx-N3 paper [LUO18] can be obtained with regularizer_params={'p': 3}.

Methods

 __init__([regularizer_params, verbose]) Initializes the hyperparameters needed by the algorithm.
__init__(regularizer_params=None, verbose=False)

Initializes the hyperparameters needed by the algorithm.

Parameters: regularizer_params (dictionary) – Consists of key-value pairs. The regularizer will check the keys to get the corresponding params: ’lambda’: (float). Weight of regularization loss for each parameter (default: 1e-5) ’p’: (int): norm (default: 2) Example: regularizer_params={'lambda': 1e-5, 'p': 1}