# Reveal.js
from notebook.services.config import ConfigManager
cm = ConfigManager()
cm.update('livereveal', {
'theme': 'white',
'transition': 'none',
'controls': 'false',
'progress': 'true',
})
{'theme': 'white', 'transition': 'none', 'controls': 'false', 'progress': 'true'}
%%html
<script>
function code_toggle() {
if (code_shown){
$('div.input').hide('500');
$('#toggleButton').val('Show Code')
} else {
$('div.input').show('500');
$('#toggleButton').val('Hide Code')
}
code_shown = !code_shown
}
$( document ).ready(function(){
code_shown=false;
$('div.input').hide()
});
</script>
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Show Code"></form>
import random
from IPython.display import Image
Image(url='../img/word_representations.svg'+'?'+str(random.random()), width=1000)
Note the different formulation in SciPy: $$cos(u, v) = 1 - \frac{u \cdot v}{||u|| \cdot||v||}$$
Image(url='../img/quiz_time.png'+'?'+str(random.random()))
"I had some cereal for breakfast today"
Training instance: target word $w \in \mathbb{V}$; context word $c \in \mathbb{V}$
$D = ((c, w),\ldots)$; observed co-occurences
"I had some cereal for breakfast today"
Create $D' = ((c, w),\ldots)$; "noise samples"
Image(url='../img/word_representations.svg'+'?'+str(random.random()), width=1200)
Image(url='../img/word_representations_zoom.svg'+'?'+str(random.random()), width=1200)
Image(url='../img/quiz_time.png'+'?'+str(random.random()))
Image(url='../img/regularities.png'+'?'+str(random.random()), width=1000)
(It's not really that simple... see Drozd et al. (2016))
Image(url='../img/embedding_sum.jpg'+'?'+str(random.random()), width=500)
Image(url='../img/embedding_weighted.jpg'+'?'+str(random.random()), width=500)
Sentence representations from scratch (e.g. with RNNs in next lecture)
Doc2vec
Image(url='../img/doc2vec_0.png'+'?'+str(random.random()), width=1000)
Image(url='../img/doc2vec_1.png'+'?'+str(random.random()), width=1000)