Skip to content

Commit

Permalink
Merge e41a95f into 584e0d0
Browse files Browse the repository at this point in the history
  • Loading branch information
srush committed Oct 26, 2019
2 parents 584e0d0 + e41a95f commit ea162eb
Show file tree
Hide file tree
Showing 12 changed files with 721 additions and 125 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ cache: pip
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update
- sudo apt-get install pandoc
- pip install -r requirements.txt
- pip install -r requirements.dev.txt
- pip install coveralls
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Expand Up @@ -3,3 +3,5 @@ sphinx-jinja
sphinxcontrib-bibtex
sphinx-rtd-theme
recommonmark
nbsphinx
pandoc
1 change: 1 addition & 0 deletions docs/source/README.md
1 change: 1 addition & 0 deletions docs/source/README_files
37 changes: 37 additions & 0 deletions docs/source/advanced.rst
@@ -0,0 +1,37 @@



============================
Advanced Usage: Semirings
============================

All of the distributional code is implemented through a series of
semiring objects. These are passed through dynamic programming
backends to compute the distributions.


Standard Semirings
===================

.. autoclass:: torch_struct.LogSemiring
.. autoclass:: torch_struct.StdSemiring
.. autoclass:: torch_struct.MaxSemiring

Higher-Order Semirings
=========================
.. autoclass:: torch_struct.EntropySemiring

Sampling Semirings
===================

.. autoclass:: torch_struct.SampledSemiring
.. autoclass:: torch_struct.MultiSampledSemiring


Dynamic Programming
===================

.. autoclass:: torch_struct.LinearChain
.. autoclass:: torch_struct.SemiMarkov
.. autoclass:: torch_struct.DepTree
.. autoclass:: torch_struct.CKY
4 changes: 3 additions & 1 deletion docs/source/conf.py
Expand Up @@ -30,7 +30,9 @@
'sphinx.ext.napoleon',
'sphinxcontrib.jinja',
'sphinxcontrib.bibtex',
'sphinx.ext.intersphinx'
'sphinx.ext.intersphinx',
'recommonmark',
'nbsphinx'
]


Expand Down
132 changes: 8 additions & 124 deletions docs/source/index.rst
@@ -1,135 +1,19 @@

=================
PyTorch-Struct
==========================================
=================

.. toctree::
:maxdepth: 2
:maxdepth: 3
:caption: Contents:

Introduction
============

A library for structured prediction.



Distributional Interface
========================


The main interface is through a structured distribution objects. Each
of these implement a conditional random field over a class of
structures. Roughly, these represent specialized softmax's over
exponentially sized spaces. Each distribution object takes in
log_potentials (generalized logits) and can return properties of the
distribution. The properties of interest are,

* Partition (e.g. logsumexp)
* Marginals (e.g. softmax)
* Argmax
* Entropy
* Samples
* to_event / from_event (adapters)


.. autoclass:: torch_struct.StructDistribution
:members:

Linear Chain
--------------

.. autoclass:: torch_struct.LinearChainCRF


Semi-Markov
--------------

.. autoclass:: torch_struct.SemiMarkovCRF


Dependency Tree
----------------


.. autoclass:: torch_struct.DependencyCRF


Binary Tree
--------------

.. autoclass:: torch_struct.TreeCRF

Context-Free Grammar
---------------------

.. autoclass:: torch_struct.SentCFG





Networks
===========

Common structured networks.


.. autoclass:: torch_struct.networks.TreeLSTM

.. autoclass:: torch_struct.networks.NeuralCFG

.. autoclass:: torch_struct.networks.SpanLSTM


Data
====

Datasets for common structured prediction tasks.

.. autoclass:: torch_struct.data.ConllXDataset
.. autoclass:: torch_struct.data.ListOpsDataset


Advanced Usage: Semirings
=========================

All of the distributional code is implemented through a series of
semiring objects. These are passed through dynamic programming
backends to compute the distributions.


Standard Semirings
------------------

.. autoclass:: torch_struct.LogSemiring
.. autoclass:: torch_struct.StdSemiring
.. autoclass:: torch_struct.MaxSemiring

Higher-Order Semirings
----------------------
.. autoclass:: torch_struct.EntropySemiring

Sampling Semirings
----------------------

.. autoclass:: torch_struct.SampledSemiring
.. autoclass:: torch_struct.MultiSampledSemiring


Dynamic Programming
-------------------

.. autoclass:: torch_struct.LinearChain
.. autoclass:: torch_struct.SemiMarkov
.. autoclass:: torch_struct.DepTree
.. autoclass:: torch_struct.CKY

README
model
networks
advanced
refs


References
==========

.. bibliography:: refs.bib


Indices and tables
Expand Down

0 comments on commit ea162eb

Please sign in to comment.