Skip to content

Commit

Permalink
added wiki to tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheusser committed Apr 18, 2018
1 parent 04b8697 commit c267b3d
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ We can further examine the number of datapoints assigned each label.
.. parsed-literal::
Counter({0: 1761, 1: 5067, 2: 1296})
Counter({0: 1296, 1: 5067, 2: 1761})
Expand Down
Binary file modified docs/tutorials/cluster_files/cluster_20_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/tutorials/geo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ We can plot a ``geo`` by calling the plot method

.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x10d457048>
<hypertools.datageometry.DataGeometry at 0x11bcd9080>
Expand Down Expand Up @@ -351,7 +351,7 @@ First, let's plot without making any changes.

.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x10d5bd4a8>
<hypertools.datageometry.DataGeometry at 0x11be41588>
Expand All @@ -374,7 +374,7 @@ specified by the reduce model set to 2.

.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x10d9c4e10>
<hypertools.datageometry.DataGeometry at 0x11c2ddcf8>
Expand Down
Binary file modified docs/tutorials/normalize_files/normalize_13_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/normalize_files/normalize_16_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/normalize_files/normalize_18_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/normalize_files/normalize_8_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/tutorials/plot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,6 @@ transformed to a topic vector and then reduced for plotting.

.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x116a621d0>
<hypertools.datageometry.DataGeometry at 0x11448fcc0>
Binary file modified docs/tutorials/plot_files/plot_22_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/plot_files/plot_31_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/plot_files/plot_37_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 43 additions & 6 deletions docs/tutorials/text.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dog[0][:1000]"
Expand All @@ -73,7 +75,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"hue=['dog']*chunk_size+['cat']*chunk_size\n",
Expand All @@ -90,7 +94,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bball_text = wiki.page('Basketball').content\n",
Expand Down Expand Up @@ -120,6 +126,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": false
},
"outputs": [],
Expand All @@ -128,6 +135,30 @@
"nips.plot(size=[8, 6])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Visualizing Wikipedia pages\n",
"\n",
"Here, we will plot a collection of wikipedia pages, transformed using a topic\n",
"model (the default 'wiki' model) that was fit on the same articles. We will\n",
"reduce the dimensionality of the data with TSNE, and then discover cluster with\n",
"the 'HDBSCAN' algorithm."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"wiki = hyp.load('wiki')\n",
"wiki.plot(size=[8, 6])"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -140,7 +171,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sotus = hyp.load('sotus')\n",
Expand All @@ -159,7 +192,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sotus.plot(reduce='UMAP', size=[10, 8])"
Expand All @@ -177,7 +212,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sotus.plot(reduce='UMAP', corpus='nips', size=[10, 8])"
Expand Down
45 changes: 30 additions & 15 deletions docs/tutorials/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,41 @@ example dataset can be loaded using the code below.
nips.plot(size=[8, 6])
.. image:: text_files/text_12_0.png




.. parsed-literal::
/Users/andyheusser/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/tables/leaf.py:396: PerformanceWarning: The Leaf ``/data`` is exceeding the maximum recommended rowsize (104857600 bytes);
be ready to see PyTables asking for *lots* of memory and possibly slow
I/O. You may want to reduce the rowsize by trimming the value of
dimensions that are orthogonal (and preferably close) to the *main*
dimension of this leave. Alternatively, in case you have specified a
very small/large chunksize, you may want to increase/decrease it.
PerformanceWarning)
<hypertools.datageometry.DataGeometry at 0x10ebe1750>
Visualizing Wikipedia pages
---------------------------

Here, we will plot a collection of wikipedia pages, transformed using a
topic model (the default 'wiki' model) that was fit on the same
articles. We will reduce the dimensionality of the data with TSNE, and
then discover cluster with the 'HDBSCAN' algorithm.

.. code:: ipython2
wiki = hyp.load('wiki')
wiki.plot(size=[8, 6])
.. image:: text_files/text_12_1.png
.. image:: text_files/text_14_0.png




.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x11c7bdcd0>
<hypertools.datageometry.DataGeometry at 0x11db6e790>
Expand All @@ -134,14 +149,14 @@ the left and republicans mostly on the right).
.. image:: text_files/text_14_0.png
.. image:: text_files/text_16_0.png




.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x1200e3750>
<hypertools.datageometry.DataGeometry at 0x117e040d0>
Expand All @@ -159,14 +174,14 @@ the data.
.. image:: text_files/text_16_0.png
.. image:: text_files/text_18_0.png




.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x116c23050>
<hypertools.datageometry.DataGeometry at 0x11bf57610>
Expand All @@ -184,14 +199,14 @@ list of text samples) to train the model.
.. image:: text_files/text_18_0.png
.. image:: text_files/text_20_0.png




.. parsed-literal::
<hypertools.datageometry.DataGeometry at 0x11e5976d0>
<hypertools.datageometry.DataGeometry at 0x11c0cf210>
Expand Down
Binary file added docs/tutorials/text_files/text_12_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/text_files/text_14_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/text_files/text_16_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/text_files/text_18_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/tutorials/text_files/text_20_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/text_files/text_7_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/tutorials/text_files/text_9_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c267b3d

Please sign in to comment.