-
Notifications
You must be signed in to change notification settings - Fork 620
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
Conversation
""" FiGNN is a novel CTR prediction model based on GGNN, | ||
which can model sophisticated interactions among feature fields on the graph-structured features. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里要指明模型类型,如PAIRWISE或POINTWISE
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议使用nn.BCEWithLogitsLoss(),可以参考一下其他context模型
""" FiGNN is a novel CTR prediction model based on GGNN, | ||
which can model sophisticated interactions among feature fields on the graph-structured features. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是在文字里,是在代码里加一下input_type = InputType.PAIRWISE
No description provided.