Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEA: Add FiGNN in Context Aware models #1509

Merged
merged 9 commits into from
Nov 14, 2022
Merged

Conversation

CIEEMio
Copy link
Contributor

@CIEEMio CIEEMio commented Oct 24, 2022

No description provided.

""" FiGNN is a novel CTR prediction model based on GGNN,
which can model sophisticated interactions among feature fields on the graph-structured features.
"""

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要指明模型类型,如PAIRWISE或POINTWISE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是在文字里,是在代码里加一下input_type = InputType.PAIRWISE

self.bias_p = nn.Parameter(torch.zeros(embedding_size))

def forward(self, g, h):
h_out = torch.matmul(self.W_out, h.unsqueeze(-1)).squeeze(-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

计算顺序尽量参考原论文公式,虽然这里应该是等价的。

self.attention_size = config['attention_size']
self.n_layers = config['n_layers']
self.num_heads = config['num_heads']
self.dropout_probs = config['dropout_probs']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个不同的dropout参数分开,增加可读性也方便调参。

self.gru_cell = nn.GRUCell(self.attention_size, self.attention_size)
# Attentional Scoring Layer
self.mlp1 = nn.Linear(self.attention_size, 1, bias=False)
self.mlp2 = nn.Sequential(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里套一层nn.Sequential是多余的

nn.Linear(self.num_feature_field * self.attention_size, self.num_feature_field, bias=False)
)
self.sigmoid = nn.Sigmoid()
self.loss = nn.BCELoss()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用nn.BCEWithLogitsLoss(),可以参考一下其他context模型

@CIEEMio CIEEMio requested review from AoiDragon and zhengbw0324 and removed request for AoiDragon November 6, 2022 02:56
""" FiGNN is a novel CTR prediction model based on GGNN,
which can model sophisticated interactions among feature fields on the graph-structured features.
"""

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是在文字里,是在代码里加一下input_type = InputType.PAIRWISE

@CIEEMio CIEEMio requested a review from zhengbw0324 November 6, 2022 06:28
@CIEEMio CIEEMio requested review from AoiDragon and removed request for zhengbw0324 November 10, 2022 12:36
@zhengbw0324 zhengbw0324 merged commit b1ec0e9 into RUCAIBox:master Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants