def visualize_classifier(self, item_number): 'show the results of running the classifier on text number item_number' if not self.trained: self.fit_and_validate() w = self.data.dev_item_token_views(item_number) s = self.dev_d[item_number] e = self.dev_d[item_number + 1] tagtools.visualize(w, { 'actual': self.dev_y[s:e], 'predicted': self.dev_predictions[s:e] })
def visualize_decoder(self, item): 'show the results of running the classifier and decoder on text number item_number' if not self.decoded: self.decode_and_validate() w = self.data.dev_item_token_views(item) s = self.dev_d[item] e = self.dev_d[item + 1] tagtools.visualize( w, { 'actual': self.dev_y[s:e], 'best': self.dev_predictions[s:e], 'predicted': self.dev_decoded[s:e] })