SlowGuess/NAACL_2021_OCR huggingface dataset:
The three medical datasets were built by sampling the clinical progress notes of children visiting the Duke University Health System between October 1, 2013 and October 1, 2018. All analyses were approved by the Duke University Institutional Review Board. Diagnosis codes (ICD-9/10) were used to identify patients eventually diagnosed with autism spectrum disorder (ASD), attention deficit hyperactivity disorder (ADHD), or asthma. Notes from each patient group were then selected at random and labeled as positive for the condition corresponding to that group. While many of these notes are not directly related to the condition of interest, a large proportion contain related information or risk factors. Future work will focus on extracting predictive spans from all notes from a given patient; here we focus on individual notes to limit complexity and highlight span extraction performance. For each diagnosis prediction task, we then selected notes from age-matched controls not diagnosed with the condition as of October 1, 2018, and assigned them a negative label. Each dataset contains an even number of positive and
negative examples. Descriptive statistics are shown in Table 1.
We first establish baseline performance for each dataset by training a CNN-based classifier that replaces span detection with max-pooling of all filter activations, but that is otherwise identical to SpanPredict. Pooled activations are fed into a linear layer that predicts the log-odds of a positive label. Our baseline model was motivated by our goal to understand how the SpanPredict module affects performance and highlight its flexibility with many baseline models, rather than to maximize performance, per se. A CNN-baseline was preferred over a BiLSTM, as the latter contains a context window of infinite length. Thus, a contiguous contiguous sequence of tokens can contain information from tokens outside the window, making span identification and interpretation difficult. Our baseline is closely related to hierarchical SWEM (Shen et al., 2018), and despite its simplicity, achieves an accuracy of  $86.3\%$  on IMDb, which is competitive against recent benchmarks (Papers with Code, 2020; Zhang et al., 2018). As shown in figure 2a, this same model achieves an AUC of 0.938.
To contextualize GloVe embeddings, we apply  $C = 3$  parallel convolutional layers, each of filter size  $F = 50$ , stride  $S = 1$ , kernel sizes  $K \in \{2,3,5\}$  and with ReLU activations. Tokens are padded such that the output of each convolution is of length  $\tilde{T}$ . We then concatenate the filters to obtain refined embeddings  $\mathbf{e}_t \in \mathbb{R}^{CF}$ , which are fed into the span detection module. Omitting the token embedding matrix, our model contains  $100 \times (2 + 3 + 5) \times F + C \times F$  parameters in the
$^{2}$ https://www.kaggle.com/snap/amazon-fine-food-reviews
convolutional layers and  $2J\times C\times F$  parameters in the span detection filters. Thus, SpanPredict contains  $2J\times C\times F$  more parameters than our baseline model, and  $\approx 50,000$  parameters in total.
We take a step-wise approach to assessing model hyperparameters by first training with only binary cross entropy loss  $(\alpha = 0)$ . We then train three models with  $\alpha = 0.1$  - chosen by comparing baseline performance on  $\alpha \in \{0.01, 0.05, 0.1, 0.2\}$  and a maximum of  $J$  spans, where  $J$  is proportional to the average document length in the dataset. For IMDb, we choose 4; for Amazon, 3; and for all diagnoses, 7. Within this set of three, we vary  $\theta$  across the values  $\{0.5, 0.475, 0.45, 0.4, 0.25\}$  to assess the impact of the JSD penalty on span size and prediction performance. In Appendix B, we show results when  $J$  is increased to 10.
For each experiment, we summarize classification performance using area under the ROC curve (AUC, for span size) and intersection over union (IoU, for span overlap). However, our goal is not to maximize classification performance, but rather to maintain good performance while also providing distinct, concise spans and scoring them accurately. To evaluate our span selection, we  $(a)$  quantify average span length and overlap for each model;  $(b)$  evaluate model-based span scoring, for which we have no ground truth, by having human raters score a random sample of spans; and  $(c)$  show a large number of spans selected by our models, which may be evaluated qualitatively (Appendix A).
For IMDb and Amazon, samples for human evaluation were selected by first filtering for correctly labeled spans ( $z_{ij} < 0$  when  $y_i = 0$ , where  $i$  indexes documents in the testing set and  $j$  indexes spans; and vice versa). The remaining spans were divided by  $z_{ij}$  into quantiles, and 40 samples were drawn from each (to ensure a roughly uniform distribution of scores). We recruited 3 native English speakers to rate each span on a 5-point scale (very negative, negative, neutral, positive, very positive).
A similar procedure was used to select spans from each medical dataset. Here, we only considered correctly labeled, condition-positive notes  $(y_{i} = 1)$ , since condition-negative notes  $(y_{i} = 0)$  are marked by the absence of information related to the diagnosis more than the presence of information denying it. To mitigate rater fatigue, we sampled 20 spans per quantile, per condition, rather than 40. Three neurology or psychiatry residents rated each span on a 5-point scale. Raters were asked to grade
the conditional probability of seeing the span given that the patient has the condition.
SpanPredict was built in Python using TensorFlow 2.1 and trained on a single NVIDIA Titan Xp GPU. We use the Adam optimizer with default values of  $\eta = 0.001$ ,  $\epsilon = 10^{-7}$ ,  $\beta_{1} = 0.9$ , and  $\beta_{2} = 0.999$ . Parameters are randomly initialized from  $\mathcal{N}(0,0.05)$  for the convolutional layers and  $\mathcal{N}(0,0.5)$  for the span detection layers. To regularize training, we employ Dropout (Srivastava et al., 2014); after selecting  $\alpha$ , Dropout rates of  $\{0.1,0.25,0.5,0.7\}$  were tested and 0.5 was chosen. We train each of our models with a batch size of 8 for 300 epochs. Our model complexity is linear in space and time with respect to  $J$ . We report performance using the model stored at the epoch with the lowest overall validation loss. To allow the model to warm up to the JSD penalty, we linearly increase  $\alpha$  from 0 to 0.1 over 150 epochs and then fix its value to 0.1 for the remainder of the experiment. We use the Keras tokenizer with a vocabulary size of 30,000 to tokenize our text and pad or truncate each sequence to a maximum length of 512 tokens.
In Figure 2, we describe trends in performance. Baseline AUCs are provided in the caption. Note that lower AUCs for diagnosis prediction reflect the comparative difficulty of these tasks. Figure 2a shows performance relative to the baseline model for varying JSD penalties. Performance decreases up to  $6\%$  as the penalty increases, with the exception of ASD, on which the model performs about as well as or better than baseline for  $\theta \in [0.4, 0.475]$ . Thus, while some information may be lost during summarization, depending on the dataset, summarization may also serve to denoise the text, improving predictive performance.
From Figure 2b, we find that as the penalty is increased, spans become considerably shorter. Inspecting the results when  $\theta = 0.25$ , we found that the model tends to focus in on key words rather than phrases. From Figure 2c, we see that overlap also shrinks with span size. The effect is more rapid for the medical datasets, likely because the non-medical passages contain text throughout that is relevant to the sentiment of the passage, whereas medical notes contain information not relevant to the prediction task. A notable exception is asthma,
Figure 3: Example spans in the IMDb (top, positive sentiment) and Amazon (bottom, mixed sentiment) datasets. Colors represent the different spans ( $J = 4$  for Amazon,  $J = 3$  for IMDb). Solid lines denote  $\mathbf{r}_j$  (heights of  $\mathbf{r}_1$  and  $\mathbf{r}_3$  rescaled for visualization purposes). Dashed lines denote  $\tilde{\mathbf{p}}_j$  and dotted lines  $\tilde{\mathbf{q}}_j$ , with shading to resolve overlap. The inset plot shows the scores  $z_j$ , which are added to predict the log-odds of a positive label.
Figure 4: Predicted log-odds versus median sentiment (3 raters) for all five datasets.
which maintains a relatively constant span size and overlap, suggesting that diagnosing asthma requires identifying specific phrases (e.g., "shortness of breath") that cannot be decomposed into individual words. Finally, we demonstrate in Appendix B that, for  $J = 10$ , AUC is, on average, greater but at the cost of greater sensitivity to  $\theta$ .
Figure 3 provides an illustration of individual spans inferred by SpanPredict  $(\theta = 0.5)$ . In the IMDb example (top), we see that the model captures two highly positive spans, each constituting  $30 - 35\%$  of the note, with words such as "professional," "laughed," and "appreciate" appearing in the red span. SpanPredict is also able to capture meanings of complex positive phrases, such as "chock full", "sure handed," "none of the over the top," and "time has come." The blue and green spans each cover only a single word; however, these words – "flawless" and "beautiful" – have significant positive connotation. This is a feature our model shares with (Shen et al., 2018), which also picks out individual tokens.
The Amazon review (Figure 3, bottom) contains mixed sentiment. The green span contains the word "quality," which, akin to words such as "care" or
"workmanship," is slightly positive. However, the blue span is filled with negative phrases. This is reflected in the  $z_{j}$  scores in the inset plot, which are added to predict the log-odds of a positive label. We find that  $z_{j}$  is negative for the blue span while positive for the green span. The orange span is most negative, suggesting that the model is able to synthesize information from the blue and green spans it overlaps to extract an overall meaning.
Figure 4 shows the human evaluation results. For each span, we computed the median rating among the 3 reviewers and performed a non-parametric ANOVA (Kruskal-Wallis test) to assess agreement with model-predicted scores. Statistically significant differences in means  $(p < 0.001)$  were present in the IMDb, Amazon, and ADHD datasets, but not the ASD and Asthma datasets. Given our model's high agreement with human raters in the IMDb and Amazon tasks, the lower agreement observed on the medical diagnosis tasks may indicate that our model is identifying descriptive risk factors not familiar to our clinical raters. This hypothesis, which was suggested by our clinical collaborators, will be explored further in subsequent work. To measure inter-rater reliability, we computed Cohen's kappa
for each dataset - IMDb: 0.73, Amazon: 0.78, ASD: 0.53, ADHD: 0.64, Asthma: 0.63. These values illustrate the difficulty of evaluating the clinical notes compared to the review datasets.
We have introduced the task of predictive extraction, in which document labels are predicted from extracted contiguous segments of text called spans. We presented SpanPredict, which constructs span representations nonparametrically from contextualized embeddings by predicting start and end positions using linear attention. Our model is straightforward to tune, and assigns interpretable span scores that are added together to predict the log-odds of a positive label. Model performance and span quality are evaluated on two non-medical and three medical datasets. Notably, we observe high correlation between human span ratings and model-predicted span scores, particularly in the non-medical datasets, illustrating that our model selects meaningful spans and scores them accurately. Discrepancies between human ratings and model predictions in the medical datasets may suggest that our model is identifying condition-specific risk factors that are unfamiliar to trained clinicians. Future work will consider prediction and span extraction from a collection of documents rather than individual documents, allowing descriptive risk factors to be extracted from patient medical histories. Clinical findings consistently highlighted by SpanPredict will be analyzed as possible risk factors via standard statistical methods. Additionally, whereas SpanPredict identifies a set of spans sufficient to predict the label, future work will explore methods for ensuring that all predictive spans are identified.
This paper introduced the problem of predictive extraction, which attempts to identify distinct spans of text within a document that, taken together, are sufficient to predict its associated label. Its positive impact can best be described within the context of disease classification from narrative clinical text. For example, ASD is a classically difficult condition to diagnose, as its symptoms are often behavioral, rather than physiological, making clinical notes critical for classification. Focus on classification alone, however, is not sufficient, as a clinical decision support tool requires a level of interpretability to assure clinicians that the model is not relying on data artifacts that are not clinically meaningful
or generalizable. This requirement is present in many document classification tasks, including the scoring of food or movie reviews. Our newly introduced algorithm, SpanPredict, addresses this need by identifying important and unlabeled predictive phrases without substantially worsening classification performance. As such, SpanPredict can be used as a real-time decision aid, providing narrative summaries optimized for disease classification, thus leading to faster diagnoses and long-term improvements in function, while minimizing healthcare cost and utilization.
While the positive impact of our contribution is clear, there are potential negative consequences related to biases in training. When algorithms are trained on patient datasets that are incomplete or under-/mis-representative of certain populations, they can develop discriminatory biases in their outcomes. When considering clinical notes, there is also potential for biased language in patient medical records related to race and ethnicity, including perpetuating of negative stereotypes, blaming a patient for their symptoms, or casting doubt on patient reports and experience. This biased language likely changes the context of words and may negatively impact classification performance. This is of particular importance in ASD, where white children with ASD receive their diagnoses substantially earlier Black children with ASD. Ignoring these biases might create self-fulfilling prophecies that confirm existing social biases or create new applications of bias altogether. In light of these negative impacts, it will become critical to evaluate the performance of SpanPredict in various populations prior to being put in production, so that all biases are well-characterized. Nonetheless, the overall impact of the paper is a net positive as it advances the field of interpretable document classification, using a novel methodology that only requires labels for the classification.
This work was funded by NIMH R01 MH121329 (Geraldine Dawson and Guillermo Sapiro, Co-PI). We gratefully acknowledge the conceptual input of Guillermo Sapiro, Geraldine Dawson, and Scott Kollins in this work.
Emily Alsentzer and Anne Kim. 2018. Extractive summarization of ehr discharge notes. arXiv preprint
arXiv:1810.12085.
Jasmijn Bastings, Wilker Aziz, and Ivan Titov. 2019. Interpretable neural predictions with differentiable binary variables. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2963-2977, Florence, Italy. Association for Computational Linguistics.
Yonatan Belinkov and James Glass. 2019. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49-72.
Jianpeng Cheng and Mirella Lapata. 2016. Neural summarization by extracting sentences and words. arXiv preprint arXiv:1603.07252.
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805.
Michael C Hughes, Leah Weiner, Gabriel Hope, Thomas H McCoy Jr, Roy H Perlis, Erik B Sudderth, and Finale Doshi-Velez. 2017. Prediction-constrained training for semi-supervised mixture and topic models. arXiv preprint arXiv:1707.07341.
Eric Jang, Shixiang Gu, and Ben Poole. 2016. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144.
Kenton Lee, Shimi Salant, Tom Kwiatkowski, Ankur Parikh, Dipanjan Das, and Jonathan Berant. 2016. Learning recurrent span representations for extractive question answering. arXiv preprint arXiv:1611.01436.
Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2016. Rationalizing neural predictions. arXiv preprint arXiv:1606.04155.
Jennifer Liang, Ching-Huei Tsou, and Ananya Poddar. 2019. A novel system for extractive clinical note summarization using ehr data. In Proceedings of the 2nd Clinical Natural Language Processing Workshop, pages 46-54.
Jianhua Lin. 1991. Divergence measures based on the shannon entropy. IEEE Transactions on Information theory, 37(1):145-151.
Xiangan Liu, Keyang Xu, Pengtao Xie, and Eric Xing. 2018. Unsupervised pseudo-labeling for extractive summarization on electronic health records. arXiv preprint arXiv:1811.08040.
Andrew L Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies-volume 1, pages 142-150. Association for Computational Linguistics.
Chris J Maddison, Andriy Mnih, and Yee Whye Teh. 2016. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712.
Christopher D Manning, Christopher D Manning, and Hinrich Schütze. 1999. Foundations of statistical natural language processing. MIT press.
Julian John McAuley and Jure Leskovec. 2013. From amateurs to connoisseurs: modeling the evolution of user expertise through online reviews. In Proceedings of the 22nd international conference on World Wide Web, pages 897-908.
Shashi Narayan, Shay B Cohen, and Mirella Lapata. 2018. Ranking sentences for extractive summarization with reinforcement learning. arXiv preprint arXiv:1802.08636.
Papers with Code. 2020. IMDb Leaderboard. https://paperswithcode.com/sota/sentiment-analysis-on-imdb.
Pranav Rajpurkar, Robin Jia, and Percy Liang. 2018. Know what you don't know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822.
Jason Ren, Russell Kunes, and Finale Doshi-Velez. 2019. Prediction focused topic models via vocab selection. arXiv preprint arXiv:1910.05495.
Dinghan Shen, Guoyin Wang, Wenlin Wang, Martin Renqiang Min, Qinliang Su, Yizhe Zhang, Chunyuan Li, Ricardo Henao, and Lawrence Carin. 2018. Baseline needs more love: On simple word-embedding-based models and associated pooling mechanisms. arXiv preprint arXiv:1805.09843.
Leslie N Smith. 2017. Cyclic learning rates for training neural networks. In 2017 IEEE Winter Conference on Applications of Computer Vision (WACV), pages 464-472. IEEE.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2014. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929-1958.
George Tucker, Andriy Mnih, Chris J Maddison, John Lawson, and Jascha Sohl-Dickstein. 2017. Rebar: Low-variance, unbiased gradient estimates for discrete latent variable models. In Advances in Neural Information Processing Systems, pages 2627-2636.
Yong Zhang, Meng Joo Er, Rui Zhao, and Mahardhika Pratama. 2016. Multiview convolutional neural networks for multidocument extractive summarization. IEEE transactions on cybernetics, 47(10):3230-3242.
Yue Zhang, Qi Liu, and Linfeng Song. 2018. Sentence-state LSTM for text representation. arXiv preprint arXiv:1805.02474.
Appendix A. Example spans
In Tables 2 through 11, we list example spans selected from each of the corpora whose log-odds scores were highly positive or highly negative.
Table 2: Selected spans among top 100 positive scores for IMDb
Span Text	Score
this wonderful film is a love story, and shows that not all relationships are destined to last. even so they can be great worth the pain suffering of	+6.13
was born to play this role, and her performance will most likely be remembered as she is supported by an ideal cast, and the direction and design are tops. it doesn’t get any better than this.	+6.12
in love with the cats break into song. with the song everybody wants to be a cat. thomas gets to love music like the other cats. thomas and really like each other. i loved this movie and i like the cats to	+6.12
i have nothing but good things to say about this tasteful and heartwarming film. i think that the effort of	+6.12
this remarkable film just gets better every time you watch it. a true cinematic work of art from a visionary director.	+6.11
a wonderful film that everyone interested in should see. but it’s not a perfect or definitive work on the subject.	+6.11
Table 3: Selected spans among top 100 negative scores for IMDb
Span Text	Score
poor ward, so lovely, but so surely she's been better in other movies.	-6.71
this turgid film that i can think of. any proper film lover will have an almost impossible time trying to find any redeeming value in this crap, definitely one to avoid.	-6.71
in another of the dreadful horror films i seem so attracted to, we have a bunch of	-6.71
of the most annoying characters ever captured on film. this crap is an insult to movies and i almost never rate a movie i don't see from start to finish, but in this case the former is impossible. 2 10	-6.70
poor souls from wasting their time and or money with this movie. i [unk] it and wish i never even wasted the hard drive space. if i spent 10 bucks to see this in theaters i would kill	-6.70
i would ward off any temptation to view this movie, it is quite simply dull. the characters are predictable and the assassin is quite [unk] there is no tension, fun, no style or even a glimmer of	-6.68
Table 4: Selected spans among top 100 positive scores for Amazon
Span Text	Score
this for the first time recently and found it awesome i made a perfect vegetable curry, very colorful and spicy. i'm going to make up another batch over the weekend, and put this curry paste on my list to order again.	+8.40
brew it correctly and you really get a beautiful cup of tea. i highly	+8.40
getting harder and harder to find in the stores so i'm stocking up from amazon. my toddler loves it and we use it on all meats. i make rice using coconut milk to serve with this and it's yum	+8.39
a very well built mole trap that works great when set correctly. the safety latch is a nice	+8.39
bowl. wonderful product and so nice that i can buy in bulk since we go through it so fast.	+8.39
a decent price depending if you do subscribe and save . these bars are great for my little ones, they love them, and they are a good healthy alternative to candy or cookies.	+8.39