Understand the structured perceptron algorithm


In [ ]:
%matplotlib inline
%load_ext autoreload
%autoreload 2

In [ ]:
from lxmls import DATA_PATH
import lxmls
import lxmls.sequences.crf_online as crfo
import lxmls.readers.pos_corpus as pcc
import lxmls.sequences.id_feature as idfc
import lxmls.sequences.extended_feature as exfc
from lxmls.readers import pos_corpus

Implement the structured perceptron algorithm.

To do this, edit file sequences/structured perceptron.py and implement the function perceptron_update.

This function should apply one round of the perceptron algorithm, updating the weights for a given sequence, and returning the number of predicted labels (which equals the sequence length) and the number of mistaken labels.


In [ ]: