yangheng95 / LCF-ATEPC

codes for paper A Multi-task Learning Model for Chinese-oriented Aspect Polarity Classification and Aspect Term Extraction
MIT License
186 stars 45 forks source link

为什么模型在预测情感极性的时候,反而传了polarities进去 #20

Closed WhatTong closed 3 years ago

WhatTong commented 3 years ago

如下代码: polarity_labels = self.get_batch_polarities(polarities) cdm_vec = self.feature_dynamic_mask(local_context_ids, polarities) loss_apc = loss_sen(apc_logits, polarity_labels)

yangheng95 commented 3 years ago

polarities 用来辅助定位aspect的位置(positions),不涉及极性的推理

WhatTong commented 3 years ago

不好意思还想问下,lcf-atepc.py里这段代码的作用是什么? batch_size, max_len, feat_dim = global_context_out.shape global_valid_output = torch.zeros(batch_size, max_len, feat_dim, dtype=torch.float32).to(self.args.device) for i in range(batch_size): jj = -1 for j in range(max_len): if valid_ids[i][j].item() == 1: jj += 1 global_valid_output[i][jj] = global_context_out[i][j]

yangheng95 commented 3 years ago

https://github.com/yangheng95/LCF-ATEPC/issues/7#issuecomment-590027225

对于被切分成多个部分的apscet,只选用第一个位置的特征分类预测IOB