{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "initial_id", "metadata": { "collapsed": true }, "outputs": [], "source": [ "import itertools\n", "import numpy as np\n", "import pandas as pd\n", "from sklearn.preprocessing import LabelEncoder" ] }, { "cell_type": "code", "execution_count": 2, "id": "775d8173", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1002355, 8)\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idtitleabstractyearlabelauthorsreferencesfos
01091Preliminary Design of a Network Protocol Learn...The purpose of this study is to develop a lear...20136[2312688602, 2482909946, 2128134587, 210178269...[2005687710, 2018037215][telecommunications network, computer science,...
115883Leveraging legacy code to deploy desktop appli...Xax is a browser plugin model that enables dev...20084[135218249, 2120803867, 2128381254, 2150137935][114793137, 186343359, 205258527, 1516211918, ...[world wide web, computer science, machine cod...
215901A pedestrian navigation method for user's safe...In recent years, most of mobile phones have a ...20136[2789599552, 2935910818][2055819696, 2167564737, 2169528473][visibility, route planning, computer science,...
338917Automated Object Identification and Position E...The development of an automated system for the...20080[2068146743, 2252543171, 1278895136, 2171534607][96589161, 2138661420, 2157641950, 2163004336,...[computer vision, aerodrome, image sensor, com...
458261A general semantic analyser for data base accessThe paper discusses the design principles and ...19810[2316496857, 2169254595][1997320166, 2042008249, 2043794661, 2061141062][front and back ends, design elements and prin...
\n", "
" ], "text/plain": [ " id title \\\n", "0 1091 Preliminary Design of a Network Protocol Learn... \n", "1 15883 Leveraging legacy code to deploy desktop appli... \n", "2 15901 A pedestrian navigation method for user's safe... \n", "3 38917 Automated Object Identification and Position E... \n", "4 58261 A general semantic analyser for data base access \n", "\n", " abstract year label \\\n", "0 The purpose of this study is to develop a lear... 2013 6 \n", "1 Xax is a browser plugin model that enables dev... 2008 4 \n", "2 In recent years, most of mobile phones have a ... 2013 6 \n", "3 The development of an automated system for the... 2008 0 \n", "4 The paper discusses the design principles and ... 1981 0 \n", "\n", " authors \\\n", "0 [2312688602, 2482909946, 2128134587, 210178269... \n", "1 [135218249, 2120803867, 2128381254, 2150137935] \n", "2 [2789599552, 2935910818] \n", "3 [2068146743, 2252543171, 1278895136, 2171534607] \n", "4 [2316496857, 2169254595] \n", "\n", " references \\\n", "0 [2005687710, 2018037215] \n", "1 [114793137, 186343359, 205258527, 1516211918, ... \n", "2 [2055819696, 2167564737, 2169528473] \n", "3 [96589161, 2138661420, 2157641950, 2163004336,... \n", "4 [1997320166, 2042008249, 2043794661, 2061141062] \n", "\n", " fos \n", "0 [telecommunications network, computer science,... \n", "1 [world wide web, computer science, machine cod... \n", "2 [visibility, route planning, computer science,... \n", "3 [computer vision, aerodrome, image sensor, com... \n", "4 [front and back ends, design elements and prin... " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "papers = pd.read_csv('dblp.v12.csv')\n", "papers['authors'] = papers['authors'].apply(eval)\n", "papers['references'] = papers['references'].apply(eval)\n", "papers['fos'] = papers['fos'].apply(eval)\n", "print(papers.shape)\n", "papers.head()" ] }, { "cell_type": "code", "execution_count": 3, "id": "add9f8dc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(14072159, np.int64(7876504))" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Extend the `references` column to a List[2005687710, 2018037215, 114793137, ...]\n", "all_references = np.array(list(itertools.chain(*(papers['references'].values))))\n", "\n", "# Construct a list containing the `id` corresponding to the above references list\n", "paper_ids = np.concatenate([np.full(count, i) \n", " for i, count in zip(papers['id'].values, papers['references'].apply(len))])\n", "\n", "assert len(all_references) == len(paper_ids)\n", "\n", "# Wether a reference is in the `id` column\n", "in_paperids = np.isin(all_references, papers['id'].values)\n", "len(in_paperids), in_paperids.sum() " ] }, { "cell_type": "code", "execution_count": 4, "id": "98a23d01", "metadata": {}, "outputs": [], "source": [ "# Filter the references list\n", "all_references = all_references[in_paperids]\n", "paper_ids = paper_ids[in_paperids]" ] }, { "cell_type": "code", "execution_count": 5, "id": "a35ac7fd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of papers that refer or are referred 964350\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idtitleabstractyearlabelauthorsreferencesfos
115883Leveraging legacy code to deploy desktop appli...Xax is a browser plugin model that enables dev...20084[135218249, 2120803867, 2128381254, 2150137935][114793137, 186343359, 205258527, 1516211918, ...[world wide web, computer science, machine cod...
215901A pedestrian navigation method for user's safe...In recent years, most of mobile phones have a ...20136[2789599552, 2935910818][2055819696, 2167564737, 2169528473][visibility, route planning, computer science,...
338917Automated Object Identification and Position E...The development of an automated system for the...20080[2068146743, 2252543171, 1278895136, 2171534607][96589161, 2138661420, 2157641950, 2163004336,...[computer vision, aerodrome, image sensor, com...
458261A general semantic analyser for data base accessThe paper discusses the design principles and ...19810[2316496857, 2169254595][1997320166, 2042008249, 2043794661, 2061141062][front and back ends, design elements and prin...
565220Two notes from experimental study on image ste...In recent years, several advanced methods for ...20130[2304723528, 2676058149, 2120394816][22271197, 29798142, 1713630528, 1955882805, 2...[steganography, steganography tools, pattern r...
\n", "
" ], "text/plain": [ " id title \\\n", "1 15883 Leveraging legacy code to deploy desktop appli... \n", "2 15901 A pedestrian navigation method for user's safe... \n", "3 38917 Automated Object Identification and Position E... \n", "4 58261 A general semantic analyser for data base access \n", "5 65220 Two notes from experimental study on image ste... \n", "\n", " abstract year label \\\n", "1 Xax is a browser plugin model that enables dev... 2008 4 \n", "2 In recent years, most of mobile phones have a ... 2013 6 \n", "3 The development of an automated system for the... 2008 0 \n", "4 The paper discusses the design principles and ... 1981 0 \n", "5 In recent years, several advanced methods for ... 2013 0 \n", "\n", " authors \\\n", "1 [135218249, 2120803867, 2128381254, 2150137935] \n", "2 [2789599552, 2935910818] \n", "3 [2068146743, 2252543171, 1278895136, 2171534607] \n", "4 [2316496857, 2169254595] \n", "5 [2304723528, 2676058149, 2120394816] \n", "\n", " references \\\n", "1 [114793137, 186343359, 205258527, 1516211918, ... \n", "2 [2055819696, 2167564737, 2169528473] \n", "3 [96589161, 2138661420, 2157641950, 2163004336,... \n", "4 [1997320166, 2042008249, 2043794661, 2061141062] \n", "5 [22271197, 29798142, 1713630528, 1955882805, 2... \n", "\n", " fos \n", "1 [world wide web, computer science, machine cod... \n", "2 [visibility, route planning, computer science,... \n", "3 [computer vision, aerodrome, image sensor, com... \n", "4 [front and back ends, design elements and prin... \n", "5 [steganography, steganography tools, pattern r... " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "has_reference1 = np.isin(papers['id'].values, paper_ids)\n", "has_reference2 = np.isin(papers['id'].values, all_references)\n", "has_reference = has_reference1 | has_reference2\n", "papers = papers[has_reference]\n", "print('Number of papers that refer or are referred', papers.shape[0])\n", "papers.head()" ] }, { "cell_type": "markdown", "id": "140f3a6b", "metadata": {}, "source": [ "## Paper-Paper Links" ] }, { "cell_type": "code", "execution_count": 6, "id": "58bc2147", "metadata": {}, "outputs": [], "source": [ "data = {}" ] }, { "cell_type": "code", "execution_count": 7, "id": "8c8a2b26", "metadata": {}, "outputs": [], "source": [ "paper_id_encoder = LabelEncoder()\n", "paper_id_encoder.fit(papers['id'].values)\n", "all_references = paper_id_encoder.transform(all_references).astype(np.int32)\n", "paper_ids = paper_id_encoder.transform(paper_ids).astype(np.int32)" ] }, { "cell_type": "code", "execution_count": 8, "id": "e59e8efe", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of paper-paper links: 7876504\n" ] } ], "source": [ "src = np.concatenate((paper_ids, all_references))\n", "dst = np.concatenate((all_references, paper_ids))\n", "mask = src < dst\n", "src = src[mask]\n", "dst = dst[mask]\n", "\n", "print('Number of paper-paper links:', src.shape[0])\n", "data['paper-paper'] = (src, dst)" ] }, { "cell_type": "markdown", "id": "c6ea40b9", "metadata": {}, "source": [ "## Paper-Author Links" ] }, { "cell_type": "code", "execution_count": 9, "id": "7ac95935", "metadata": {}, "outputs": [], "source": [ "paper_ids = np.concatenate([np.full(count, i) \n", " for i, count in zip(papers['id'].values, papers['authors'].apply(len))])\n", "authors = list(itertools.chain(*(papers['authors'].values)))" ] }, { "cell_type": "code", "execution_count": 10, "id": "a18d2f9c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of authors: 958961\n" ] } ], "source": [ "author_id_encoder = LabelEncoder()\n", "author_ids = author_id_encoder.fit_transform(authors).astype(np.int32)\n", "print('Number of authors:', len(author_id_encoder.classes_))" ] }, { "cell_type": "code", "execution_count": 11, "id": "c26050f6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of paper-author links: 3070343\n" ] } ], "source": [ "paper_ids = paper_id_encoder.transform(paper_ids).astype(np.int32)\n", "assert len(author_ids) == len(paper_ids)\n", "print('Number of paper-author links:', paper_ids.shape[0])\n", "data['paper-author'] = (paper_ids, author_ids)" ] }, { "cell_type": "markdown", "id": "dac2cf56", "metadata": {}, "source": [ "## Paper-FoS Links" ] }, { "cell_type": "code", "execution_count": 12, "id": "84c81398", "metadata": {}, "outputs": [], "source": [ "paper_ids = np.concatenate([np.full(count, i) \n", " for i, count in zip(papers['id'].values, papers['fos'].apply(len))])\n", "foss = list(itertools.chain(*(papers['fos'].values)))" ] }, { "cell_type": "code", "execution_count": 13, "id": "4b01e746", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of FoS: 65699\n" ] } ], "source": [ "fos_id_encoder = LabelEncoder()\n", "fos_ids = fos_id_encoder.fit_transform(foss).astype(np.int32)\n", "print('Number of FoS:', len(fos_id_encoder.classes_))" ] }, { "cell_type": "code", "execution_count": 14, "id": "db87e8fe", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of paper-fos links: 10086883\n" ] } ], "source": [ "paper_ids = paper_id_encoder.transform(paper_ids).astype(np.int32)\n", "\n", "assert len(fos_ids) == len(paper_ids)\n", "print('Number of paper-fos links:', fos_ids.shape[0])\n", "data['paper-fos'] = (paper_ids, fos_ids)" ] }, { "cell_type": "code", "execution_count": null, "id": "bfe4abd3", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "59b8e0bf", "metadata": {}, "source": [ "## Labels and Years" ] }, { "cell_type": "code", "execution_count": 15, "id": "2f2e6972", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idtitleabstractyearlabelauthorsreferencesfos
9643453008425973A Simulation Model Demonstrating the Impact of...In addition to seamless connectivity and smart...20200[3008013535][1969595988, 2024456547, 2106660896, 240927666...[social objects, computer science, cooperative...
9643463008480875Scaling Blockchains to Support Electronic Heal...Electronic Health Records (EHRs) have improved...20202[3000482756, 2560842277, 2096420846][1593596963, 2038708100, 2071551483, 216457208...[health care, architecture, computer science, ...
9643473008559546How Good Is a Strategy in a Game with NatureWe consider games with two antagonistic player...20207[2083017933, 2033699461][157185084, 744920664, 1502459210, 1513485037,...[discrete mathematics, graph, infinite game, d...
9643483008721399Chunking in Soar: The Anatomy of a General Lea...In this article we describe an approach to the...19860[2098086841, 237745248, 2126658068][10646503, 38913427, 86408651, 152570004, 1597...[anatomy, architecture, chunking (psychology),...
9643493008773848Shorter identifier names take longer to compre...Developers spend the majority of their time co...20174[2576839772, 2145688174, 2166709612][1490674333, 1842503650, 1967931023, 203468809...[identifier, computer science, artificial inte...
\n", "
" ], "text/plain": [ " id title \\\n", "964345 3008425973 A Simulation Model Demonstrating the Impact of... \n", "964346 3008480875 Scaling Blockchains to Support Electronic Heal... \n", "964347 3008559546 How Good Is a Strategy in a Game with Nature \n", "964348 3008721399 Chunking in Soar: The Anatomy of a General Lea... \n", "964349 3008773848 Shorter identifier names take longer to compre... \n", "\n", " abstract year label \\\n", "964345 In addition to seamless connectivity and smart... 2020 0 \n", "964346 Electronic Health Records (EHRs) have improved... 2020 2 \n", "964347 We consider games with two antagonistic player... 2020 7 \n", "964348 In this article we describe an approach to the... 1986 0 \n", "964349 Developers spend the majority of their time co... 2017 4 \n", "\n", " authors \\\n", "964345 [3008013535] \n", "964346 [3000482756, 2560842277, 2096420846] \n", "964347 [2083017933, 2033699461] \n", "964348 [2098086841, 237745248, 2126658068] \n", "964349 [2576839772, 2145688174, 2166709612] \n", "\n", " references \\\n", "964345 [1969595988, 2024456547, 2106660896, 240927666... \n", "964346 [1593596963, 2038708100, 2071551483, 216457208... \n", "964347 [157185084, 744920664, 1502459210, 1513485037,... \n", "964348 [10646503, 38913427, 86408651, 152570004, 1597... \n", "964349 [1490674333, 1842503650, 1967931023, 203468809... \n", "\n", " fos \n", "964345 [social objects, computer science, cooperative... \n", "964346 [health care, architecture, computer science, ... \n", "964347 [discrete mathematics, graph, infinite game, d... \n", "964348 [anatomy, architecture, chunking (psychology),... \n", "964349 [identifier, computer science, artificial inte... " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Reorder papers\n", "\n", "papers.set_index('id', inplace=True)\n", "papers = papers.loc[paper_id_encoder.classes_]\n", "papers.reset_index(inplace=True)\n", "papers.tail()\n" ] }, { "cell_type": "code", "execution_count": 16, "id": "316ae0b2", "metadata": {}, "outputs": [], "source": [ "paper_years = papers['year'].values.astype(np.int16)\n", "data['paper_years'] = paper_years" ] }, { "cell_type": "code", "execution_count": 17, "id": "64536f16", "metadata": {}, "outputs": [], "source": [ "paper_labels = papers['label'].values.astype(np.int8)\n", "data['paper_labels'] = paper_labels" ] }, { "cell_type": "code", "execution_count": 18, "id": "e0333a3d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'paper-paper': (array([ 0, 0, 0, ..., 16345, 732, 7251], dtype=int32),\n", " array([13858, 61018, 81249, ..., 19830, 744, 19890], dtype=int32)),\n", " 'paper-author': (array([ 0, 0, 0, ..., 19890, 19890, 19882], dtype=int32),\n", " array([ 10439, 196586, 212053, ..., 685977, 455354, 510243], dtype=int32)),\n", " 'paper-fos': (array([ 0, 0, 0, ..., 19882, 19882, 19882], dtype=int32),\n", " array([65253, 10791, 33819, ..., 43792, 2953, 38524], dtype=int32)),\n", " 'paper_years': array([2008, 2013, 2008, ..., 2020, 1986, 2017], dtype=int16),\n", " 'paper_labels': array([4, 6, 0, ..., 7, 0, 4], dtype=int8)}" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data" ] }, { "cell_type": "code", "execution_count": 19, "id": "fce3faf6", "metadata": {}, "outputs": [], "source": [ "papers.to_csv('DBLP.csv', index=False)" ] }, { "cell_type": "markdown", "id": "32d3dd5f", "metadata": {}, "source": [ "### Node Features\n", "\n", "We generate embeddings as features for each node in the graph. Node embeddings are generated by passing the title and the abstract through a Sentence-BERT model and obtaining a 384-embedding vector for each movie node.\n", "\n", "\n", "According to [Sentence-Transformers docs](https://www.sbert.net/docs/pretrained_models.html), the **all-MiniLM-L6-v2** model provides the best quality. So we use it to generate node features.\n", "\n", "all-MiniLM-L6-v2\n", "\n", "Description:\tAll-round model tuned for many use-cases. Trained on a large and diverse dataset of over 1 billion training pairs.\n", "Base Model:\tnreimers/MiniLM-L6-H384-uncased\n", "Max Sequence Length:\t256\n", "Dimensions:\t384\n", "Normalized Embeddings:\ttrue\n", "Suitable Score Functions:\tdot-product (util.dot_score), cosine-similarity (util.cos_sim), euclidean distance\n", "Size:\t80 MB\n", "Pooling:\tMean Pooling\n", "Training Data:\t1B+ training pairs. For details, see model card.\n", "Model Card:\thttps://huggingface.co/sentence-transformers/all-MiniLM-L6-v2\n" ] }, { "cell_type": "code", "execution_count": 20, "id": "1b3b9b1d", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/lib/python3.10/dist-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "data": { "text/plain": [ "SentenceTransformer(\n", " (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel \n", " (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})\n", " (2): Normalize()\n", ")" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import torch\n", "from sentence_transformers import SentenceTransformer\n", "\n", "device = 'cuda:0' if torch.cuda.is_available() else 'cpu'\n", "model = SentenceTransformer('../sentence-transformers/all-MiniLM-L6-v2', device=device)\n", "model" ] }, { "cell_type": "code", "execution_count": 21, "id": "346dc6fa", "metadata": {}, "outputs": [], "source": [ "text = papers['title'] + ' ' + papers['abstract']" ] }, { "cell_type": "code", "execution_count": 22, "id": "cfcef3f2", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Batches: 100%|██████████| 236/236 [12:22<00:00, 3.15s/it]\n" ] } ], "source": [ "feats = model.encode(text, batch_size=4096, show_progress_bar=True, convert_to_numpy=True)" ] }, { "cell_type": "code", "execution_count": 23, "id": "ba74f1f9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'paper-paper': (array([ 0, 0, 0, ..., 16345, 732, 7251], dtype=int32),\n", " array([13858, 61018, 81249, ..., 19830, 744, 19890], dtype=int32)),\n", " 'paper-author': (array([ 0, 0, 0, ..., 19890, 19890, 19882], dtype=int32),\n", " array([ 10439, 196586, 212053, ..., 685977, 455354, 510243], dtype=int32)),\n", " 'paper-fos': (array([ 0, 0, 0, ..., 19882, 19882, 19882], dtype=int32),\n", " array([65253, 10791, 33819, ..., 43792, 2953, 38524], dtype=int32)),\n", " 'paper_years': array([2008, 2013, 2008, ..., 2020, 1986, 2017], dtype=int16),\n", " 'paper_labels': array([4, 6, 0, ..., 7, 0, 4], dtype=int8),\n", " 'paper_feats': array([[-0.09045218, -0.04914903, -0.00183934, ..., -0.02621997,\n", " 0.10682236, 0.03757928],\n", " [ 0.05457439, -0.03537758, -0.00981656, ..., 0.02816821,\n", " -0.08244677, 0.05598091],\n", " [ 0.05163385, -0.00435178, 0.00543169, ..., 0.04312224,\n", " -0.08650234, 0.02618632],\n", " ...,\n", " [ 0.00644145, -0.02942889, -0.03935754, ..., 0.00694911,\n", " 0.04468951, -0.01565437],\n", " [-0.00039966, 0.06023127, -0.01369713, ..., 0.05656872,\n", " -0.0026328 , 0.03119653],\n", " [-0.02327097, 0.01399295, 0.02802348, ..., 0.07121975,\n", " 0.03597061, -0.01132829]], dtype=float32)}" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['paper_feats'] = feats\n", "data" ] }, { "cell_type": "code", "execution_count": 24, "id": "6a123fee", "metadata": {}, "outputs": [], "source": [ "import pickle\n", "\n", "with open('dblp.pkl', 'wb') as f:\n", " pickle.dump(data, f)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }