Day04-数据分析实战-论文种类分类(DataWhale)

本文探讨了如何利用现有Arxiv数据,通过文本处理将论文标题和摘要合并,对类别进行编码,然后运用TF-IDF和深度学习(如LSTM)模型进行多标签分类。实验结果显示了两种方法在学术论文类别识别上的有效性。
摘要由CSDN通过智能技术生成

主题:论文种类分类

利用已有数据建模,对新论文进行类别分类

使用论文标题完成类别分类

import seaborn as sns
from bs4 import BeautifulSoup
import re 
import json 
import pandas as pd 
import matplotlib.pyplot as plt
def readArxivFile(path, columns=['id', 'submitter', 'authors', 'title', 'comments', 'journal-ref', 'doi',
       'report-no', 'categories', 'license', 'abstract', 'versions',
       'update_date', 'authors_parsed'], count=None):
    '''
    定义读取文件的函数
        path: 文件路径
        columns: 需要选择的列
        count: 读取行数
    '''
    
    data  = []
    with open(path, 'r') as f: 
        for idx, line in enumerate(f): 
            if idx == count:
                break
                
            d = json.loads(line)
            d = {
   col : d[col] for col in columns}
            data.append(d)

    data = pd.DataFrame(data)
    return data

data = readArxivFile('arxiv-metadata-oai-snapshot.json', 
                     ['id', 'title', 'categories', 'abstract'],
                    200000)
data.head(2)
id title categories abstract
0 0704.0001 Calculation of prompt diphoton production cros... hep-ph A fully differential calculation in perturba...
1 0704.0002 Sparsity-certifying Graph Decompositions math.CO cs.CG We describe a new algorithm, the $(k,\ell)$-...

1. 数据处理

data1 = data
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值