LpRegularizer

class LpRegularizer(weight=1.0, dim=- 1, normalize=False, p=2.0, apply_only_once=False, parameters=None)[source]

Bases: pykeen.regularizers.Regularizer

A simple L_p norm based regularizer.

Instantiate the regularizer.

Parameters
  • weight (float) – The relative weight of the regularization

  • apply_only_once (bool) – Should the regularization be applied more than once after reset?

  • parameters (Optional[Iterable[Parameter]]) – Specific parameters to track. if none given, it’s expected that your model automatically delegates to the update() function.

Attributes Summary

hpo_default

The default strategy for optimizing the LP regularizer’s hyper-parameters

Methods Summary

forward(x)

Compute the regularization term for one tensor.

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {'weight': {'high': 1.0, 'low': 0.01, 'scale': 'log', 'type': <class 'float'>}}

The default strategy for optimizing the LP regularizer’s hyper-parameters

Methods Documentation

forward(x)[source]

Compute the regularization term for one tensor.

Return type

FloatTensor