Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/bmabey/pyLDAvis: (84 commits)
  fixes other typo in gl notebook
  fix typo
  use the graphlab API for it's prepare, 3x+ speed improvement!
  updates notebook with models from LDAvis package
  replaces use of map with list comprehension to help with bmabey#8
  pass kargs to prepare fn in gensim and graphlab helpers. Closes bmabey#6, bmabey#7.
  releases v1.2.0
  adds link to the R vignette that explains the visualization
  prevents prepare from blowing up when used with a vocab smaller than R
  make the gensim extraction more explicit... trying to find bug in logic
  updates gensim adapter to get topic term dists directly /ht @cscorley
  fixes Makefile to run on osx
  releases v1.1.0
  change how web assets are served from github.. using detatched branch
  fixes graphlab viz
  fixes bug in graphlab model prepare causing bogus visualizations!
  doc fixes
  fix pypi badge
  release v1.0.0
  prep for v1.0.0 release
  ...
  • Loading branch information
paul-english committed Jul 21, 2015
2 parents 98e1eb2 + 6e7144b commit 0ccaca3
Show file tree
Hide file tree
Showing 45 changed files with 3,833 additions and 497 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Packages
*.egg
.eggs
*.egg-info
dist
build
Expand Down
31 changes: 28 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,35 @@ python:
- "3.4"
- "3.3"
- "2.7"
- "2.6"

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -r requirements.txt
env:
- DEPS="numpy=1.9.2 pandas=0.16.0 jinja2=2.7.2 scikit-bio=0.2.3 joblib=0.8.4 numexpr pytest"

before_install:
# conda instructions from http://conda.pydata.org/docs/travis.html
- sudo apt-get update
# We do this conditionally because it saves us some downloading if the
# version is the same.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
install:
- conda create -n testenv --yes python=$TRAVIS_PYTHON_VERSION
- source activate testenv
- conda install --yes $DEPS
- python setup.py install
# download JSON data from github since travis does not have git-lfs rolled out yet
- (cd tests/data; curl -L -O https://github.com/bmabey/pyLDAvis/raw/master/tests/data/movie_reviews_input.json && curl -L -O https://github.com/bmabey/pyLDAvis/raw/master/tests/data/movie_reviews_output.json)
- ls -la tests/data/

# command to run tests, e.g. python setup.py test
script: python setup.py test
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Development Lead
Contributors
------------

None yet. Why not be the first?
* Paul English <[email protected]> - JS and CSS fixes and improvements.
7 changes: 0 additions & 7 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,3 @@ Before you submit a pull request, check that it meets these guidelines:
3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check
https://travis-ci.org/bmabey/pyLDAvis/pull_requests
and make sure that the tests pass for all supported Python versions.

Tips
----

To run a subset of tests::

$ python -m unittest tests.test_pyLDAvis
14 changes: 12 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
History
-------

0.1.0 (2015-04-06)
1.2.0 (2015-06-13)
---------------------

* First release on PyPI.
* Updates gensim logic to be clearer and work with Python 3.x.

1.1.0 (2015-06-02)
---------------------

* Fixes bug with GraphLab function that was producing bogus visualizations.

1.0.0 (2015-05-29)
---------------------

* First release on PyPI. Faithful port of R version with IPython support and helper functions for GraphLab & gensim.
6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ include HISTORY.rst
include LICENSE
include README.rst

recursive-include tests *
recursive-include tests *.py
recursive-include notebooks *.ipynb
recursive-exclude notebooks/.ipynb_checkpoints *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
include tests/data/movie_reviews_input.json tests/data/movie_reviews_output.json tests/data/export_data.R

recursive-include docs *.rst conf.py Makefile make.bat
recursive-include pyLDAvis *.py *.js *.css
28 changes: 12 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ help:
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-test - remove test and coverage artifacts"
@echo "lint - check style with flake8"
@echo "fetch_R_data - download needed data files and computes expected outputs for tests"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
Expand All @@ -18,33 +17,30 @@ help:
clean: clean-build clean-pyc clean-test

clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
rm -rf build/
rm -rf dist/
rm -rf .eggs/
find . -name '*.egg-info' -exec rm -rf {} +
find . -name '*.egg' -exec rm -rf {} +

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '__pycache__' -exec rm -rf {} +

clean-test:
rm -fr .tox/
rm -rf .tox/
rm -f .coverage
rm -fr htmlcov/
rm -rf htmlcov/

lint:
flake8 pyLDAvis tests

fetch_R_data:
(cd tests/data && ./export_data.R)

test: fetch_R_data
test:
python setup.py test

test-all: fetch_R_data
test-all:
tox

coverage:
Expand All @@ -63,11 +59,11 @@ docs:

release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload
#python setup.py bdist_wheel upload

dist: clean
python setup.py sdist
python setup.py bdist_wheel
#python setup.py bdist_wheel
ls -l dist

install: clean
Expand Down
22 changes: 0 additions & 22 deletions README.md

This file was deleted.

64 changes: 64 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pyLDAvis
========

Python library for interactive topic model visualization.
This is a port of the fabulous `R package <https://github.com/cpsievert/LDAvis>`__ by Carson Sievert and Kenny Shirley.

.. figure:: http://www2.research.att.com/~kshirley/figures/ldavis-pic.png
:alt: LDAvis icon

**pyLDAvis** is designed to help users interpret the topics in a topic model that has been fit to a corpus of text data. The package extracts information from a fitted LDA topic model to inform an interactive web-based visualization.

The visualization is intended to be used within an IPython notebook but can also be saved to a stand-alone HTML file for easy sharing.

|version status| |build status| |docs|

Installation
~~~~~~~~~~~~~~~~~~~~~~

- Stable version using pip:

::

pip install pyldavis

- Development version on GitHub

Clone the repository and run ``python setup.py``

Usage
~~~~~~~~~~~~~~~~~~~~~~

The best way to learn how to use **pyLDAvis** is to see it in action.
Check out this `notebook for an overview <http://nbviewer.ipython.org/github/bmabey/pyLDAvis/blob/master/notebooks/pyLDAvis_overview.ipynb>`__.
Refer to the `documentation <https://pyLDAvis.readthedocs.org>`__ for details.

For a concise explanation of the visualization see this
`vignette <http://cran.r-project.org/web/packages/LDAvis/vignettes/details.pdf>`__ from the LDAvis R package.

Video demos
~~~~~~~~~~~

Carson Sievert created a video demoing the R package. The visualization is the same and so it applies equally to pyLDAvis:

- `Visualizing & Exploring the Twenty Newsgroup Data <http://stat-graphics.org/movies/ldavis.html>`__

More documentation
~~~~~~~~~~~~~~~~~~

To read about the methodology behind pyLDAvis, see `the original
paper <http://nlp.stanford.edu/events/illvi2014/papers/sievert-illvi2014.pdf>`__,
which was presented at the `2014 ACL Workshop on Interactive Language
Learning, Visualization, and
Interfaces <http://nlp.stanford.edu/events/illvi2014/>`__ in Baltimore
on June 27, 2014.




.. |version status| image:: https://img.shields.io/pypi/v/pyLDAvis.svg
:target: https://pypi.python.org/pypi/pyLDAvis
.. |build status| image:: https://travis-ci.org/bmabey/pyLDAvis.png?branch=master
:target: https://travis-ci.org/bmabey/pyLDAvis
.. |docs| image:: https://readthedocs.org/projects/pyldavis/badge/?version=latest
:target: https://pyLDAvis.readthedocs.org
25 changes: 20 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
import sys
import os

# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
import mock

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# Get the project root dir, which is the parent dir of this
Expand All @@ -31,16 +32,30 @@
# version is used.
sys.path.insert(0, project_root)

MOCK_MODULES = ['numpy','joblib', 'funcy', 'scipy', 'scipy.stats', 'scipy.spatial',
'scipy.spatial.distance', 'pandas', 'skbio', 'skbio.stats',
'skbio.stats.distance', 'skbio.stats.ordination']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()

import pyLDAvis



# -- General configuration ---------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'numpydoc']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
12 changes: 0 additions & 12 deletions docs/installation.rst

This file was deleted.

17 changes: 17 additions & 0 deletions docs/modules/API.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
API documentation
=================

.. automodule:: pyLDAvis
:members:

.. automodule:: pyLDAvis.gensim
:members:

.. automodule:: pyLDAvis.graphlab
:members:

.. automodule:: pyLDAvis.utils
:members:

.. automodule:: pyLDAvis.urls
:members:
7 changes: 0 additions & 7 deletions docs/usage.rst

This file was deleted.

Loading

0 comments on commit 0ccaca3

Please sign in to comment.