jamesmullenbach / caml-mimic

multilabel classification of EHR notes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about the last logistic layer.

datduong opened this issue · comments

Hi James,

I'm trying to understand the code in your model.py.

I see that at line 106, you have self.final = nn.Linear(num_filter_maps, Y). The Y is of dimension about 8930.

Please correctly me if I am wrong. As I understand, this nn.Linear is a trick, so that you can use the weight matrix so you can do pointwise multiplication in line 135 with y = self.final.weight.mul(m).sum(dim=2).add(self.final.bias).

nn.Linear is not used in the standard sense like in pytorch tutorial; for example, we would usually run self.final(some-input).

Is this correct?

Yes, that's right. It's a little different since we want to apply each final prediction vector to its corresponding document representation.