Elman trained a network to predict the next word of a stream of short sentences. The next word is not determined, so he scored the network's output not against the actual next word but against the likelihood vector: the probability of every possible next word, measured on the corpus. Compute those vectors and the two scores he reported.
Implement likelihood_vectors(sentences, vocab) and score(outputs, likelihoods).
likelihood_vectors
sentences: list of sentences, each a non-empty list of words. They are read as one stream in order, and the stream wraps around: the last sentence is followed by the first.vocab: list of all words; position of a vector refers to vocab[j].len(vocab)), one row per word in stream order.score
outputs, likelihoods: arrays of the same shape ."rms_mean", "rms_sd", "cos_mean", "cos_sd": mean and population standard deviation over rows, each rounded to 4 decimals.