Repository: pykeen/pykeen
Issue: LCWATrainingLoop vs SLCWATrainingLoop
GitHub labels: question

### What is your question

I believe the documentation is incorrect where [it](https://pykeen.readthedocs.io/en/stable/api/pykeen.training.LCWATrainingLoop.html#pykeen.training.LCWATrainingLoop) claims that "[[ruffinelli2020]](https://pykeen.readthedocs.io/en/stable/references.html#ruffinelli2020) call the LCWA _KvsAll_ in their work." From reading the relevant [section](https://openreview.net/pdf?id=BkxSmlBFvr) (Sec 2:Training type) it seems that the authors describe it as _1vsAll_, since _KvsAll_ involves batching over triples. 

Please let me know if I'm correct in my undrestanding. If so, updating the API doc to match would make things clearer! 

### Environment

| Key             | Value                       |
|-----------------|-----------------------------|
| OS              | posix                       |
| Platform        | Linux                       |
| Release         | 3.10.0-1160.45.1.el7.x86_64 |
| Time            | Sat May 21 20:18:40 2022    |
| Python          | 3.8.12                      |
| PyKEEN          | 1.8.1                       |
| PyKEEN Hash     | UNHASHED                    |
| PyKEEN Branch   |                             |
| PyTorch         | 1.11.0                      |
| CUDA Available? | true                        |
| CUDA Version    | 11.1                        |
| cuDNN Version   | 8005                        |

### Issue Template Checks

- [X] This is not a bug report (use a different issue template if it is)
- [X] This is not a feature request (use a different issue template if it is)
- [X] I've read the text explaining why including environment information is important and understand if I omit this information that my issue will be dismissed

Hi @vsocrates ,

thanks for checking our documentation. From ["You CAN Teach an Old Dog New Tricks! On Training Knowledge Graph Embeddings", Ruffinelli et al., 2020](https://openreview.net/forum?id=BkxSmlBFvr) we have

> Finally, Dettmers et al. (2018) proposed a training type that we term KvsAll [2]: this approach (i) constructs batches from non-empty rows (i, k, ∗) or (∗, k, j) instead of from individual triples, and (ii) labels all such triples as either positive (occurs in training data) or negative (otherwise).
>
> [2] Note that the KvsAll strategy is called 1-N scoring in Dettmers et al. (2018).

Compared to the implementation of creating LCWA instances [here](https://github.com/pykeen/pykeen/blob/e26fb956c96528c0d12c63cf6de05b0cf4bf71c4/src/pykeen/triples/instances.py#L341-L380), we do the  same thing, i.e., group the triples by key - either `(h, r)` or `(r, t)` - and create *one* training sample for them with an appropriate `k`-hot target. So, if I am not mistaken, these two settings are equivalent.

Apologies, I should have checked the code before opening an issue. 

I think that's right, I was a bit confused by the description in the docs but following through to the description of the 1-N scoring function in [Dettmers 2018](https://pykeen.readthedocs.io/en/stable/references.html#dettmers2018) cleared it up! 

No worries. If you have any suggestions how to improve the doc, feel free to suggest it :slightly_smiling_face: 

From my reading to doc  of Pykeen and [Dettmers 2018](https://pykeen.readthedocs.io/en/stable/references.html#dettmers2018)  and training section in this  [paper](https://openreview.net/pdf?id=BkxSmlBFvr). I have question about difference between LCWA and SlCWA ? 

As I understood, **LCWA**: take  all possible entities as tail for example to this positive triple (h,r,*) .The main issue in calculate the  loss function since the  final loss value for this triple will be considered after taking the sum of loss score of positive against all negative corrupted triple so it is called (1-N scoring in original paper or KvsAll) and not (1-1 scoring). 

Regarding **SLCWA**,  the main difference that we determine (N) how many negative triple generated for positive triples and other steps the same. 

But in both we can determine which side to be corrupted as in SLCWA :`corruption_scheme   `and LCWA: (`target`) [0,1,2]

Is this difference right ? 

> From my reading to doc of Pykeen and [Dettmers 2018](https://pykeen.readthedocs.io/en/stable/references.html#dettmers2018) and training section in this [paper](https://openreview.net/pdf?id=BkxSmlBFvr). I have question about difference between LCWA and SlCWA ?
> 
> As I understood, **LCWA**: take all possible entities as tail for example to this positive triple (h,r,*) .The main issue in calculate the loss function since the final loss value for this triple will be considered after taking the sum of loss score of positive against all negative corrupted triple so it is called (1-N scoring in original paper or KvsAll) and not (1-1 scoring).
> 
> Regarding **SLCWA**, the main difference that we determine (N) how many negative triple generated for positive triples and other steps the same.
> 
> But in both we can determine which side to be corrupted as in SLCWA :`corruption_scheme `and LCWA: (`target`) [0,1,2]
> 
> Is this difference right ?

can you please bring this question to a new thread in https://github.com/pykeen/pykeen/discussions and provide full context? It's important to keep each thread focused, and we only have limited time for support

can you please bring this question to a new thread in https://github.com/pykeen/pykeen/discussions and provide full context? It's important to keep each thread focused, and we only have limited time for support

> I thought this Question talking about same area of  my question `LCWATrainingLoop vs SLCWATrainingLoop` 
and my question related to the difference between them?