% cat data 2 a A b B 2 c B d A # usage: # ./hw2.py % ./hw2.py --debug data weights.learned iter 0 sentence 1 x START a b y START A B y_hat START A A weight update: E_A_a -1 weight update: E_A_b -1 weight update: T_A_A -1 weight update: T_START_A -1 weight update: E_A_a 1 weight update: E_B_b 1 weight update: T_A_B 1 weight update: T_START_A 1 sentence 2 x START c d y START B A y_hat START A B weight update: E_A_c -1 weight update: E_B_d -1 weight update: T_A_B -1 weight update: T_START_A -1 weight update: E_A_d 1 weight update: E_B_c 1 weight update: T_B_A 1 weight update: T_START_B 1 errors in this iter 2 weight vector: E_A_a 0 E_A_b -1 E_A_c -1 E_A_d 1 E_B_b 1 E_B_c 1 E_B_d -1 T_A_A -1 T_A_B 0 T_B_A 1 T_START_A -1 T_START_B 1 iter 1 sentence 1 x START a b y START A B y_hat START B B weight update: E_B_a -1 weight update: E_B_b -1 weight update: T_B_B -1 weight update: T_START_B -1 weight update: E_A_a 1 weight update: E_B_b 1 weight update: T_A_B 1 weight update: T_START_A 1 sentence 2 x START c d y START B A y_hat START B A errors in this iter 1 weight vector: E_A_a 1 E_A_b -1 E_A_c -1 E_A_d 1 E_B_a -1 E_B_b 1 E_B_c 1 E_B_d -1 T_A_A -1 T_A_B 1 T_B_A 1 T_B_B -1 T_START_A 0 T_START_B 0 iter 2 sentence 1 x START a b y START A B y_hat START A B sentence 2 x START c d y START B A y_hat START B A errors in this iter 0 weight vector: E_A_a 1 E_A_b -1 E_A_c -1 E_A_d 1 E_B_a -1 E_B_b 1 E_B_c 1 E_B_d -1 T_A_A -1 T_A_B 1 T_B_A 1 T_B_B -1 T_START_A 0 T_START_B 0 No errors in this iter, stopping now # let's try it without without debug output % ./hw2.py data weights.learned iter 0 errors in this iter 2 iter 1 errors in this iter 1 iter 2 errors in this iter 0 No errors in this iter, stopping now # now let's look at the output % ls weights.learned* weights.learned.0 weights.learned.1 weights.learned.2 % cat weights.learned.2 E_A_a 1 E_A_b -1 E_A_c -1 E_A_d 1 E_B_a -1 E_B_b 1 E_B_c 1 E_B_d -1 T_A_A -1 T_A_B 1 T_B_A 1 T_B_B -1 T_START_A 0 T_START_B 0 1) Training on the real data will take a few hours, so allow plenty of time. 2) The real output of the program is the weights file. You do not need to produce the debug output shown. I recommend that you produce something similar when the program is given a "--debug" command line argument. 3) You should output a weights file after each iteration through the data. If the command line argument is weights_file, you should write out files weights_file.0, weights_file.1, weights_file.2, etc. 4) This is a minor point that will not factor heavily into grading. In order to make the behavior of the algorithm deterministic, we need to specify which sequence is chosen by the argmax when there is a tie in scores. The rule to break ties is as follows: order the set of tags according to the order in which they first appear in the training file. To break ties between tag sequences, choose the sequence that is lexicographically first according to our ordering among tags (not according to English alphabetical order). For example, suppose the training data file is: 2 a Y b Z 2 a Y b X The order of the tags is: Y Z X The following sequences are in lexicographic order: Y Y Y Y Y Z Y Y X X Y Y X Y Z X Y X On the very first sentence, all outputs have weight zero, so the result of the argmax should be Y Y Y.