hsqmlzno1 / Transferable-E2E-ABSA

Transferable End-to-End Aspect-based Sentiment Analysis with Selective Adversarial Learning (EMNLP'19)
MIT License
65 stars 13 forks source link

模型训练时目标域也需要标签训练数据吗? #3

Open 27182812 opened 3 years ago

27182812 commented 3 years ago

您好,通过阅读代码,模型训练时好像也用上了目标域的标记好的训练数据。 所以,如果我想要用在一个全新的领域还是需要标注的吗?

hsqmlzno1 commented 3 years ago

您好,通过阅读代码,模型训练时好像也用上了目标域的标记好的训练数据。 所以,如果我想要用在一个全新的领域还是需要标注的吗?

只用到了目标领域的无标签数据,所以不需要标注

27182812 commented 3 years ago

for i in range(int(batch_num)):

        xs, win_xs, length_s, ys_ote, ys_ts, ys_opn, ys_stm, _, _ = S_batches.__next__()
        xt, win_xt, length_t, yt_ote, yt_ts, yt_opn, yt_stm, _, _ = T_batches.__next__()
        x = np.vstack([xs, xt])
        win_x  = np.vstack([win_xs, win_xt])
        length = np.hstack([length_s, length_t])
        y_ote  = np.vstack([ys_ote, yt_ote])
        y_ts   = np.vstack([ys_ts, yt_ts])
        y_opn   = np.vstack([ys_opn, yt_opn])
        y_stm  = np.vstack([ys_stm, yt_stm])

        feed_dict = get_train_feed_dict(model, x, win_x, length, y_ote, y_ts, y_opn, y_stm, cur_lr, params.dropout_rate, train_flag=True)

        _, loss, asp_loss, ts_loss, opn_loss = sess.run([model.train_op, model.loss, model.asp_loss, model.ts_loss, model.opn_loss], feed_dict=feed_dict)
        _, ote_transfer_loss = sess.run([model.ote_transfer_op, model.ote_transfer_loss], feed_dict=feed_dict)
        losses.add([loss, asp_loss, ts_loss, opn_loss, ote_transfer_loss])

那请问这里的作用是什么啊?用到了T_batch,要是我目标域没有标注数据,这边不会报错吗