NLLMulticlass¶
-
class
ampligraph.latent_features.
NLLMulticlass
(eta, loss_params={}, verbose=False)¶ Multiclass NLL Loss.
Introduced in [aC15] where both the subject and objects are corrupted (to use it in this way pass corrupt_sides = [‘s’, ‘o’] to embedding_model_params) .
This loss was re-engineered in [KBK17] where only the object was corrupted to get improved performance (to use it in this way pass corrupt_sides = ‘o’ to embedding_model_params).
\[\mathcal{L(X)} = -\sum_{x_{e_1,e_2,r_k} \in X} log\,p(e_2|e_1,r_k) -\sum_{x_{e_1,e_2,r_k} \in X} log\,p(e_1|r_k, e_2)\]Examples
>>> from ampligraph.latent_features import TransE >>> model = TransE(batches_count=1, seed=555, epochs=20, k=10, >>> embedding_model_params={'corrupt_sides':['s', 'o']}, >>> loss='multiclass_nll', loss_params={})
Methods
__init__
(eta[, loss_params, verbose])Initialize Loss -
__init__
(eta, loss_params={}, verbose=False)¶ Initialize Loss
Parameters: - eta (int) – number of negatives
- loss_params (dict) – Dictionary of loss-specific hyperparams:
-