cambridge-mlg/cnaps

What is the identity class used for?

Closed this issue · 3 comments

Hi authors,
Thank you very much for your great work! I am reading your code and have a question in set_enconder.py.

cnaps/src/set_encoder.py

Lines 42 to 47 in 5a11dc0

class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x

What is the class identity used for? Is it the rho (.) function in line29(see following)

g(X) = rho ( mean ( phi(x) ) )

It just seems that it does not change itself because the class Identity just returns the input parameter. Why you need to do post_pooling_fn step?

jfb54 commented

Thanks for your interest in CNAPs. Correct. The class Identity is just a placeholder for the rho(.) function in the Deep Sets representation (http://papers.nips.cc/paper/6931-deep-sets.pdf). Early on, we experimented with different functions for rho(.), but in the end we just set rho(.) to identity. Thus, the Identityclass is doing nothing and the post_pooling_fn step can be deleted. We'll do this in our next revision, but for now it has no effect.

Thank you so much for your patient reply, this is very helpful! 👍

jfb54 commented

This change has now been pushed.