{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import json\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import scipy as sp\n", "from scipy import stats\n", "import sklearn\n", "\n", "%matplotlib inline\n", "plt.style.use('ggplot')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[u'Neuroscience', u'Cell biology']" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "with open(\"../json/filenames_topics_scores.json\", 'r') as f:\n", " topics_articles = json.load(f)\n", " \n", "topics_articles.keys()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "480\n", "['article', 'subject', 0.05900852995442989, u'mutant', 0.2085584692144273, u'reduced', 0.31061342923191704, u'amplitude', 0.1819439911921947, u'electrophysiological', 0.21618370087221447, u'mir9', 0.23960080551442975, u'aiv', 0.20781428583199402, u'vertes', 0.01683167050949445, u'class', 0.19853348284406702, u'conductance']\n" ] } ], "source": [ "header = ['article', 'subject']\n", "\n", "for subject, articles in topics_articles.iteritems():\n", " for pub_id, topics in articles.iteritems():\n", " header.extend(topics) \n", " \n", "print len(header)\n", "print header[:20]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }