Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha committed Oct 28, 2019
1 parent 50c9284 commit 31cfe95
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
12 changes: 4 additions & 8 deletions docs/source/model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@
".. autoclass:: torch_struct.HMM"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -651,7 +644,10 @@
"raw_mimetype": "text/restructuredtext"
},
"source": [
" .. autoclass:: torch_struct.Autoregressive"
" .. autoclass:: torch_struct.Autoregressive\n",
" :members: sample,sample_without_replacement,greedy_max,beam_topk\n",
" .. autoclass:: torch_struct.AutoregressiveModel\n",
" "
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ @incollection{eisner2000bilexical
publisher={Springer}
}

@inproceedings{eisner2002parameter,
@inproceedings{eisner2002parameter,
title={Parameter estimation for probabilistic finite-state transducers},
author={Eisner, Jason},
booktitle={Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics},
Expand Down
50 changes: 49 additions & 1 deletion docs/source/semiring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
" show(m.sum(-1).sum(0).sum(0).transpose(0,1), \"Alignment example\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Log"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -164,6 +171,13 @@
"run(torch_struct.LogSemiring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Max"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -231,6 +245,13 @@
"run(torch_struct.MaxSemiring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## K-Max"
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -289,6 +310,13 @@
"run(torch_struct.KMaxSemiring(3))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Counting"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -356,6 +384,13 @@
"run(torch_struct.StdSemiring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Sampled"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -490,6 +525,13 @@
"run(torch_struct.MultiSampledSemiring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Entropy"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -557,6 +599,13 @@
"run(torch_struct.EntropySemiring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Sparsemax"
]
},
{
"cell_type": "raw",
"metadata": {
Expand Down Expand Up @@ -643,7 +692,6 @@
}
],
"source": [
"\n",
"all_sr = [(\"marginals\", torch_struct.LogSemiring), \n",
" (\"argmax\", torch_struct.MaxSemiring),\n",
" (\"sample\", torch_struct.SampledSemiring),\n",
Expand Down
12 changes: 6 additions & 6 deletions torch_struct/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class LinearChainCRF(StructDistribution):
Implementation uses linear-scan, forward-pass only.
* Parallel Time: `O(\log(N))` parallel merges.
* Parallel Time: :math:`O(\log(N))` parallel merges.
* Forward Memory: :math:`O(N \log(N) C^2)`
"""
Expand All @@ -217,7 +217,7 @@ class AlignmentCRF(StructDistribution):
Implementation uses linear-scan.
* Parallel Time: `O(\log (M +N))` parallel merges.
* Parallel Time: :math:`O(\log (M +N))` parallel merges.
* Forward Memory: :math:`O((M+N)^3)`
"""
Expand Down Expand Up @@ -263,7 +263,7 @@ class SemiMarkovCRF(StructDistribution):
Implementation uses linear-scan, forward-pass only.
* Parallel Time: `O(\log(N))` parallel merges.
* Parallel Time: :math:`O(\log(N))` parallel merges.
* Forward Memory: :math:`O(N \log(N) C^2 K^2)`
"""
Expand Down Expand Up @@ -292,7 +292,7 @@ class DependencyCRF(StructDistribution):
Implementation uses linear-scan, forward-pass only.
* Parallel Time: `O(N)` parallel merges.
* Parallel Time: :math:`O(N)` parallel merges.
* Forward Memory: :math:`O(N \log(N) C^2 K^2)`
"""
Expand All @@ -318,7 +318,7 @@ class TreeCRF(StructDistribution):
Implementation uses width-batched, forward-pass only
* Parallel Time: `O(N)` parallel merges.
* Parallel Time: :math:`O(N)` parallel merges.
* Forward Memory: :math:`O(N^2)`
Compact representation: *N x N x NT* long tensor (Same)
Expand All @@ -342,7 +342,7 @@ class SentCFG(StructDistribution):
Implementation uses width-batched, forward-pass only
* Parallel Time: `O(N)` parallel merges.
* Parallel Time: :math:`O(N)` parallel merges.
* Forward Memory: :math:`O(N^2 (NT+T))`
Compact representation: *N x N x NT* long tensor
Expand Down

0 comments on commit 31cfe95

Please sign in to comment.