科大訊飛學術論文分類挑戰賽 0.79+ baseline

1、賽事背景

隨着人工智能技術不斷髮展,每週都有非常多的論文公開發布。現如今對論文進行分類逐漸成爲非常現實的問題,這也是研究人員和研究機構每天都面臨的問題。現在希望選手能構建一個論文分類模型。

2、賽事任務

本次賽題希望參賽選手利用論文信息:論文id、標題、摘要,劃分論文具體類別。

賽題樣例(使用\t分隔):

  • paperid:9821

  • title:Calculation of prompt diphoton production cross sections at Tevatron and LHC energies

  • abstract:A fully differential calculation in perturbative quantum chromodynamics is presented for the production of massive photon pairs at hadron colliders. All next-to-leading order perturbative contributions from quark-antiquark, gluon-(anti)quark, and gluon-gluon subprocesses are included, as well as all-orders resummation of initial-state gluon radiation valid at next-to-next-to-leading logarithmic accuracy.

  • categories:hep-ph

3、評審規則

1. 數據說明

訓練數據和測試集以csv文件給出,其中:

  • 訓練集5W篇論文。其中每篇論文都包含論文id、標題、摘要和類別四個字段。

  • 測試集1W篇論文。其中每篇論文都包含論文id、標題、摘要,不包含論文類別字段。

2. 評估指標

本次競賽的評價標準採用準確率指標,最高分爲1。計算方法參考https://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html, 評估代碼參考:

from sklearn.metrics import accuracy_score
y_pred = [0, 2, 1, 3]
y_true = [0, 1, 2, 3]
accuracy_score(y_true, y_pred)

3. 評測及排行

1、賽事提供下載數據,選手在本地進行算法調試,在比賽頁面提交結果。

2、每支團隊每天最多提交3次。

3、排行按照得分從高到低排序,排行榜將選擇團隊的歷史最優成績進行排名。

4、作品提交要求

文件格式:預測結果文件按照csv格式提交

文件大小:無要求

提交次數限制:每支隊伍每天最多3次

預測結果文件詳細說明:

  1. 以csv格式提交,編碼爲UTF-8,第一行爲表頭;

  2. 提交前請確保預測結果的格式與sample_submit.csv中的格式一致。具體格式如下:

paperid,categories

test_00000,cs.CV

test_00001,cs.DC

test_00002,cs.AI

test_00003,cs.NI

test_00004,cs.SE

5、賽程規則

正式賽

7月12日——8月11日

  • 初賽截止成績以團隊在初賽時間段內最優成績爲準(不含測試排名)。

  • 初賽作品提交截止日期爲8月11日17:00;正式賽名次公佈日期爲8月12日10:00。

長期賽

8月12日——9月20日

因賽事以學習實踐爲主,正式賽將轉變爲長期賽,供開發者學習實踐。本階段提交後,系統會根據成績持續更新榜單,但該階段榜單不再進行公示和獎勵。

6、獎項設置

本賽題設立一、二、三等獎各一名,具體詳情如下:

  • 一等獎:1支隊伍,周賽一等獎證書,獎金:1000元

  • 二等獎:1支隊伍,周賽二等獎證書,獎金:800元

  • 三等獎:1支隊伍,周賽三等獎證書,獎金:500元

7 、基於Roberta的學術論文分類模型

  • 分類標籤分佈:


  • 文本長度統計

拼接後title和abstract的文本長度分佈

import gc
import os

import numpy as np
import pandas as pd
import seaborn as sns
import torch
from pylab import rcParams
from simpletransformers.classification import ClassificationModel, ClassificationArgs
from sklearn.metrics import accuracy_score

os.environ["CUDA_VISIBLE_DEVICES"] = "0"  # 設置顯卡
# 配置

sns.set(style='whitegrid', palette='muted', font_scale=1.2)
HAPPY_COLORS_PALETTE = ["#01BEFE", "#FFDD00", "#FF7D00", "#FF006D", "#ADFF02", "#8F00FF"]
sns.set_palette(sns.color_palette(HAPPY_COLORS_PALETTE))
rcParams['figure.figsize'] = 25, 20
RANDOM_SEED = 42
np.random.seed(RANDOM_SEED)
torch.manual_seed(RANDOM_SEED)

train = pd.read_csv('data/train/train.csv', sep='\t')
test = pd.read_csv('data/test/test.csv', sep='\t')
sub = pd.read_csv('data/sample_submit.csv')

# 拼接title與abstract
train['text'] = train['title'] + ' ' + train['abstract']
test['text'] = test['title'] + ' ' + test['abstract']

label_id2cate = dict(enumerate(train.categories.unique()))
label_cate2id = {value: key for key, value in label_id2cate.items()}

train['label'] = train['categories'].map(label_cate2id)

train = train[['text', 'label']]
train_y = train["label"]

train_df = train[['text', 'label']][:45000]
eval_df = train[['text', 'label']][45000:]

model_args = ClassificationArgs()
model_args.max_seq_length = 20
model_args.train_batch_size = 8
model_args.num_train_epochs = 1
model_args.fp16 = False
model_args.evaluate_during_training = False
model_args.overwrite_output_dir = True

model_type = 'roberta'
model_name = 'roberta-base'
print("training {}.........".format(model_name))
model_args.cache_dir = './caches' + '/' + model_name.split('/')[-1]
model_args.output_dir = './outputs' + '/' + model_name.split('/')[-1]

model = ClassificationModel(
    model_type,
    model_name,
    num_labels=39,
    args=model_args)

model.train_model(train_df, eval_df=eval_df)
result, _, _ = model.eval_model(eval_df, acc=accuracy_score)
print(result)

data = []
for index, row in test.iterrows():
    data.append(str(row['text']))
predictions, raw_outputs = model.predict(data)
sub = pd.read_csv('data/sample_submit.csv')
sub['categories'] = predictions
sub['categories'] = sub['categories'].map(label_id2cate)
sub.to_csv('result/submit_{}.csv'.format(model_name), index=False)
del model
gc.collect()

線上提交結果:

6   返回分數    0.7937  1_roberta-base_addlen.csv       致Great  2021-07-12 16:04:22

8 、提升思路

  • 【論文解讀】文本分類上分利器:Bert微調trick大全
    https://zhuanlan.zhihu.com/p/386603816
  • 嘗試傳統LSTM、CNN、hierarchical attention networks (長文本分類)
  • 不同模型結果融合(Blending/Voting)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章