Permalink
Browse files

demo updated; closes #48

  • Loading branch information...
1 parent 1c66bb2 commit df746b9a34654fed66e21c83cee4eb6203db503b @tyarkoni tyarkoni committed Feb 27, 2015
Showing with 13 additions and 14 deletions.
  1. +13 −14 examples/neurosynth_demo.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:375a43c0325bc377ddd068e5c71665e83f8397885c6beef268e74a468b1209e0"
+ "signature": "sha256:50e4cdbede98c219da80d1458d72154b1cb1b8c640ab54735c462b6036ef0ab4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -52,15 +52,14 @@
"collapsed": false,
"input": [
"# Core functionality for managing and accessing data\n",
- "from neurosynth.base.dataset import Dataset\n",
+ "from neurosynth import Dataset\n",
"# Analysis tools for meta-analysis, image decoding, and coactivation analysis\n",
- "from neurosynth.analysis import meta, decode, network\n",
- "# The root-level module, included here just so we can set the logging level.\n",
- "import neurosynth"
+ "from neurosynth import meta, decode, network"
],
"language": "python",
"metadata": {},
- "outputs": []
+ "outputs": [],
+ "prompt_number": 1
},
{
"cell_type": "markdown",
@@ -155,7 +154,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ids = dataset.get_ids_by_features('emo*', threshold=0.001)"
+ "ids = dataset.get_studies(features='emo*', frequency_threshold=0.05)"
],
"language": "python",
"metadata": {},
@@ -165,7 +164,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Here we're asking for a list of IDs of all studies that use words starting with 'emo' (e.g.,'emotion', 'emotional', 'emotionally', etc.) at a frequency of 1 in 1,000 words or greater (in other words, if an article has 5,000 words of text, it will only be included in our set if it uses words starting with 'emo' at least 5 times). Let's find out how many studies are in our list:"
+ "Here we're asking for a list of IDs of all studies that use words starting with 'emo' (e.g.,'emotion', 'emotional', 'emotionally', etc.) with a loading greater than 0.05. In the default feature set we loaded above, values reflect <a href=\"http://en.wikipedia.org/wiki/Tf%E2%80%93idf\">tf-idf</a> frequencies. Tf-idf is a normalized frequency metric that ranges from 0 to 1. Let's find out how many studies are in our list:"
]
},
{
@@ -182,7 +181,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "The resulting set includes 1381 studies (if you get a different number, you're probably using a different version of the feature file, but all the examples in this notebook should still run just fine).\n",
+ "The resulting set includes 1264 studies (if you get a different number, you're probably using a different version of the feature file, but all the examples in this notebook should still run just fine).\n",
"\n",
"Once we've got a set of studies we're happy with, we can run a simple meta-analysis, prefixing all output files with the string 'emotion' to distinguish them from other analyses we might run:"
]
@@ -192,7 +191,7 @@
"collapsed": false,
"input": [
"# Run a meta-analysis on emotion\n",
- "ids = dataset.get_ids_by_features('emo*', threshold=0.001)\n",
+ "ids = dataset.get_ids_by_features('emo*', threshold=0.05)\n",
"ma = meta.MetaAnalysis(dataset, ids)\n",
"ma.save_results('.', 'emotion')"
],
@@ -217,7 +216,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ids = dataset.get_ids_by_expression('emo* &~ (reward* | pain*)', threshold=0.001)\n",
+ "ids = dataset.get_studies(expression='emo* &~ (reward* | pain*)', frequency_threshold=0.05)\n",
"ma = meta.MetaAnalysis(dataset, ids)\n",
"ma.save_results('.', 'emotion_without_reward_or_pain')\n",
"print \"Found %d studies.\" % len(ids)"
@@ -230,7 +229,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "This meta-analysis is somewhat more restrictive than the previous one (1193 instead of 1381), and the result should theoretically be at least somewhat more spatially specific.\n",
+ "This meta-analysis is somewhat more restrictive than the previous one (1108 instead of 1264), and the result should theoretically be at least somewhat more spatially specific.\n",
"\n",
"There's no inherent restriction on how many terms you combine or how deeply you nest logical expressions within parentheses, but the cardinal of GIGO (garbage in, garbage out) always applies, so if your expression is very specific and the number of studies drops too far (in practice, sensible results are unlikely with fewer than 50 studies), don't expect to see much.\n",
"\n",
@@ -244,11 +243,11 @@
"collapsed": false,
"input": [
"# Get the recognition studies and print some info...\n",
- "recog_ids = dataset.get_ids_by_features('recognition', threshold=0.001)\n",
+ "recog_ids = dataset.get_ids_by_features('recognition', threshold=0.05)\n",
"print \"We found %d studies of recognition\" % len(recog_ids)\n",
"\n",
"# Repeat for recollection studies\n",
- "recoll_ids = dataset.get_ids_by_features('recollection', threshold=0.001)\n",
+ "recoll_ids = dataset.get_ids_by_features('recollection', threshold=0.05)\n",
"print \"We found %d studies of recollection\" % len(recoll_ids)\n",
"\n",
"# Run the meta-analysis\n",

0 comments on commit df746b9

Please sign in to comment.