LPRegularizer

class ampligraph.latent_features.LPRegularizer(hyperparam_dict={'lambda': 1e-05, 'p': 2}, 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 is the p-norm and \(\lambda\) is the regularization weight.

p==1 does L1 regularization; p==2 does L2 regularization and so on.

Methods

__init__([hyperparam_dict, verbose]) Initializes the hyperparameters needed by the algorithm.
__init__(hyperparam_dict={'lambda': 1e-05, 'p': 2}, verbose=False)

Initializes the hyperparameters needed by the algorithm.

Parameters:hyperparam_dict (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)