aboutsummaryrefslogtreecommitdiff
path: root/static/src/gzip-classification.tex
diff options
context:
space:
mode:
Diffstat (limited to 'static/src/gzip-classification.tex')
-rw-r--r--static/src/gzip-classification.tex1
1 files changed, 1 insertions, 0 deletions
diff --git a/static/src/gzip-classification.tex b/static/src/gzip-classification.tex
index 74282d8..7b414cb 100644
--- a/static/src/gzip-classification.tex
+++ b/static/src/gzip-classification.tex
@@ -179,6 +179,7 @@ class ZipModel:
for v in self.vocabulary
])
return scipy.special.log_softmax(-code_lengths*self.conversion*(1/temperature))
+
def sample(self, prefix="", temperature=1):
scores = self.logprobs(prefix, temperature=temperature)
i = np.random.choice(range(len(self.vocabulary)), p=np.exp(scores))