# Predicting Different Types of Subtle Toxicity in Unhealthy Online
Conversations

Shlok Gilda
University of Florida
<EMAIL_ADDRESS>
Mirela Silva
University of Florida
<EMAIL_ADDRESS>
Luiz Giovanini
University of Florida
<EMAIL_ADDRESS>
Daniela Oliveira
University of Florida
<EMAIL_ADDRESS>

###### Abstract

This paper investigates the use of machine learning models for the
classification of unhealthy online conversations containing one or more forms
of subtler abuse, such as hostility, sarcasm, and generalization. We leveraged
a public dataset of 44K online comments containing healthy and unhealthy
comments labeled with seven forms of subtle toxicity. We were able to
distinguish between these comments with a top micro F1-score, macro F1-score,
and ROC-AUC of 88.76%, 67.98%, and 0.71, respectively. Hostile comments were
easier to detect than other types of unhealthy comments. We also conducted a
sentiment analysis which revealed that most types of unhealthy comments were
associated with a slight negative sentiment, with hostile comments being the
most negative ones.

##  1 Introduction

Healthy online conversations occur when posts or comments are made in good
faith, are not blatantly abusive or hostile, typically focus on substance and
ideas, and generally invite engagement Price et al. (2020). Conversely, toxic
comments are a harmful type of conversation widely found online which are
insulting and violent in nature Price et al. (2020), such as “SHUT UP, YOU FAT
POOP, OR I WILL KICK YOUR A**!!!”. This kind of toxic conversation has been
the primary focus of several previous studies Georgakopoulos et al. (2018);
Srivastava et al. (2018). However, many comments that deter people from
engaging in online conversations are not necessarily outright abusive, but
contain subtle forms of abuse (e.g., “Because it drives you crazy, old lady.
Toodooloo…”). These comments are written in a way to engage people, but to
also hurt, antagonize, or humiliate others and are thus referred to as
_unhealthy conversations_ Price et al. (2020). In other words, unhealthy
comments are less negative, intense, and hostile than toxic ones. Detecting
unhealthy conversations is more challenging and less explored in the
literature than its toxic conversations counterpart Price et al. (2020).

Many early signs of conversational failure are due to the subtlety in comments
which deter people from engagement and create downward spirals in
interactions. Behaviors such as condescension (e.g., “Utter drivel and
undeserving of further response.”), “benevolent” stereotyping (e.g., “Women
have motherly nurturing instincts.”), and microaggressions (e.g., racially-
based such as “Why don’t you have an accent?”) are frequently experienced by
members of minority social groups Sue et al. (2007); Glick and Fiske (2001).
Nadal et al. (2014) indicated that such subtle abuse can be as emotionally
harmful as outright toxic abuse to some individuals. Microaggressions (even
unintended slights or social cues) have been linked to disagreements in
intergroup relationships. Jurgens et al. (2019) also signify the importance of
tackling more subtle and serious forms of online abuse by developing proactive
technologies (e.g., intervention by bystanders [Markey, 2000], rephrasing
parts of a message to adjust the level of politeness [Sennrich et al., 2016])
to counter abuse before it can cause harm.

In this paper, we sought to answer two research questions in the context of
unhealthy conversations:

  * •

RQ1: What is the general sentiment associated with unhealthy conversations
compared to healthy conversations?

  * •

RQ2: Can we differentiate unhealthy and healthy conversations? If so, which
type of unhealthy conversation is the most detectable?

Towards this end, we analyzed a dataset comprised of 44K labeled comments of
unhealthy conversations from Price et al. (2020). We submitted this dataset
first to sentiment analysis aimed at detecting the polarity
(positive/negative/neutral) of the comments (RQ1), and then to a comprehensive
machine learning analysis focused on distinguishing comments as healthy vs.
unhealthy. (RQ2). Our experimental results revealed that: (i) although none of
the types of comments had extremely polarizing sentiments, most forms of
unhealthy online conversations were associated with a slight negative
sentiment; and (ii) hostile comments were the most detectable form of
unhealthy conversation. Findings from this work have the potential to inform
and advance future research and development of online moderation tools, which
pave the way for safer online environments.

This paper is organized as follows. Section 2 summarizes related work. Section
3 describes the dataset we leveraged for our experiments, as well as our
preprocessing procedures. Section 4 details our study’s methodology. Section 5
analyzes our study’s results, and discusses our results by answering our
proposed research questions. Section 6 analyzes our study’s limitations and
proposes directions for future work. Section 7 concludes the paper.

##  2 Related Work

Sentiment classification of social media posts with regards to toxicity has
been researched extensively over the past years Chen and Qian (2019); Saeed et
al. (2018); Saif et al. (2018); Srivastava et al. (2018). The primary focus of
most of the related work has been on algorithmic moderation of toxic comments,
which are derogatory and threatening. The importance of community norms in
detection and classification of these subtler forms of abuse have been noted
elsewhere Blackwell et al. (2017); Guberman and Hemphill (2017); Liu et al.
(2018); Salminen et al. (2018), but have not received the same attention in
the NLP community.

Although recognized in the larger NLP abuse typology Waseem et al. (2017),
there have been only a few attempts at solving the problems associated with
subtle abuse detection, such as a study on classification of ambivalent sexism
using Twitter data Jha and Mamidi (2017). There is a need for development of
new methods to identify the implicit signals of conversational cues. Detecting
subtler forms of toxicity requires idiosyncratic knowledge, familiarity with
the conversation context, or familiarity with the cultural tropes van Aken et
al. (2018); Parekh and Patel (2017). It also requires reasoning about the
implications of the propositions. Dinakar et al. (2012) extract implicit
assumptions in statements and use common sense reasoning to identify social
norm violations that would be considered an insult.

Identification of subtle indicators of unhealthy conversations in online
comments is a challenging task due to three main reasons Price et al. (2020):
(i) comments are less extreme and thus have lesser explicit vocabulary; (ii) a
remark may be perceived differently based on context or expectations of the
reader; and (iii) greater risk of false positives or false negatives. Cultural
diversity also plays an important role on how a comment/remark may be
perceived differently Qiufen (2014), thus making identification of subtle
toxicity online more challenging.

From a machine learning perspective, abusive comments classification research
initially began with the application of combining TF-IDF (Term
Frequency–Inverse Document Frequency) with sentiment and contextual features
by Yin et al. (2009). They compared the performance of this model with a
simple TF-IDF model and reported a 6% increase in the F1-score of the
classifier on chat-style datasets. Since then, there have been many advances
in the field of toxicity classification. Davidson et al. (2017) detected hate
speech on Twitter using a three-way classifier: hate speech, offensive but not
hate speech, and none. They implemented Logistic Regression and SVM
classifiers using several different features including TF-IDF n-grams, Part-
of-Speech (POS) $n$-grams, Flesch Reading Ease scores, and sentiment scores
using an existing sentiment lexicon. Using a similar set of features, Safi
Samghabadi et al. (2017) applied a linear SVM to detect “invective” posts on
Ask.fm, a social networking site for asking questions. They also utilized
additional features such as Linguistic Inquiry and Word Count (LIWC;
Pennebaker et al., 2001), word2vec Mikolov et al. (2013), paragraph2vec Le and
Mikolov (2014), and topic modeling. The authors reported an F1-score of 59%
and AUC-ROC (area under the ROC curve) of 0.785 using a specific subset of
features. Yu et al. (2017) proposed a word vector refinement model that could
be applied to pre-trained word vectors (e.g., Word2Vec [Mikolov et al., 2013]
and Glove [Pennington et al., 2014a]) to improve the efficiency of sentiment
analysis. Chu et al. (2016) compared the performance of various deep learning
approaches to toxicity classification, using both word and character
embeddings. They analyzed the performance of neural networks with LSTM (Long
Short-Term Memory) and word embeddings, a CNN (Convolution Neural Network)
with word embeddings, and another CNN with character embeddings; the latter
achieved top accuracy of 93%.

This paper aims to tackle the issue of recognizing unhealthy online
conversations. Existing research usually focuses on classifying the most
hateful/vile comments; we, on the other hand, aimed to identify the subtle
toxicity indicators in online conversations.

##  3 Data Preparation

In this section, we describe the dataset of 44K labeled comments of unhealthy
conversations from Price et al. (2020), and detail the preprocessing steps
taken to prepare the dataset for our machine learning analyses.

###  3.1 Dataset Description

The dataset used in this study was made publicly
available111https://github.com/conversationai/unhealthy-conversations by Price
et al. (2020) in October 2020. It contains 44,355 unique comments of 250
characters or less from the Globe and Mail222https://www.theglobeandmail.com/
opinion articles sampled from the Simon Fraser University Opinion and Comments
Corpus dataset by Kolhatkar et al. (2020). Each comment was coded by at least
three annotators with at least one of the following class labels: antagonize,
condescending, dismissive, generalization, generalization unfair, healthy,
hostile, and sarcastic. A maximum of five annotators were used per comment
until sufficient consensus—measured by a confidence score $\geq$ 75%—was
reached. Each annotator was asked to identify for each comment whether it was
healthy and if any of the types of unhealthy discourse (i.e., condescending,
generalization, etc.) were present or not. The comments were presented in
isolation to annotators, without the surrounding context of the news article
and other comments (i.e., the annotators had no additional context about where
the comment was posted or about the engagement of the comment with the users),
thus possibly reducing bias. Since the comments were sourced from the SFU
Opinion and Comments Corpus dataset, the prevalence of each attribute is
unavoidably low.

The following are a few examples of every class label:

  1. 1.

_Antagonize:_ “An idiot criticizing another idiot, seems about right.”

  2. 2.

_Condescending:_ “So, everyone who disagrees with her - and YOU - are
fascists? You’re just another pouting SJW333Social Justice Warrior; a
pejorative term typically aimed at someone who espouses socially liberal
movements., angry that you didn’t get a ‘Participant’ trophy…”

  3. 3.

_Dismissive:_ “You are certifiably a nut job with that comment.”

  4. 4.

_Generalization:_ “This is all on the Greeks. Period. They are the ones who
have been overspending for decades and lying about it.”

  5. 5.

_Generalization Unfair:_ “Progressives ALWAYS go over the top. They cannot
help it. It’s part of their MO.”

  6. 6.

_Healthy:_ “We are seeing fascist tendencies and behaviours in our government,
but its [sic] so hard to believe that it is happening to us, to Canada, that
we will just continue to be in denial.”

  7. 7.

_Hostile:_ “Crazy religious f**kers are the cause of overpopulating the planet
with inbred, uneducated people with poor prospects of earning a satisfying
life. An endless pool of desperate terrorists in waiting.”

  8. 8.

_Sarcastic:_ “You should write another comment, [user] - there are a few
right-wing buzzwords you didn’t use yet. Not many, but some.”

Price et al. (2020) used Krippendorff’s $\alpha$ as the inter-rater
reliability metric for the crowd-sourced annotators (note, however, that they
did not report the $\alpha$ for two labels: healthy and generalization
unfair). Opposite to most inter-rater reliability metrics which address
agreement, Krippendorff’s $\alpha$ measures the _disagreement_ among coders,
ranging from 0 (perfect disagreement) to 1 (perfect agreement). Table 1 lists
the Krippendorff’s $\alpha$ for each attribute (reproduced from Price et al.,
2020), along with the final distribution of our preprocessed dataset (detailed
below).

Table 1: Distribution of comments per category along with the respective Krippendorff’s $\alpha$ reported by Price et al. (2020). Note that some comments (10.6%) were attributed to multiple labels. Class label | Count | K-alpha
---|---|---
Antagonize | 2,066 | 0.39
Condescending | 2,434 | 0.36
Dismissive | 1,364 | 0.31
Generalization | 944 | 0.35
Generalization Unfair | 890 | Not reported
Healthy | 41,040 | Not reported
Hostile | 1,130 | 0.36
Sarcastic | 1,897 | 0.34

###  3.2 Preprocessing

First, we removed one comment from the dataset that was empty and 1,106 other
comments which were not assigned to any class label. This decreased the total
number of comments to 43,248. All comments were then preprocessed for the
feature extraction step. We converted all characters to lower-case, then
removed HTML tags, non-alphabetic characters, newline, tab characters, and
punctuation from the comments. We also converted accented characters to their
standardized representations to avoid our classifier ambiguating words such as
“latte” and “latté.” We then expanded contractions (e.g., “don’t” is replaced
with “do not”). The final step was lemmatization, which consists of reducing
words to their root forms (e.g., “playing” becomes “play”). After
preprocessing the data, three comments were deleted because they contained
just numbers or special characters. Thus, the total number of comments was
43,245 with an average length of 19.8 words. The final distribution of the
preprocessed dataset is shown in Table 1. Most of the comments were assigned
to a single class label ($N=38,661$, 89.4%), while 10.6% of the comments
($N=4,584$) were associated with two or more labels.

##  4 Methodology and Analysis

This section describes our feature engineering process followed by a detailed
description of our machine learning analysis targeting the recognition of
unhealthy comments through a diverse set of classification models, including
traditional and deep architectures. We also describe the process of sentiment
analysis of the comments.

###  4.1 Feature Engineering

We vectorized the comments using the Term Frequency-Inverse Document Frequency
(TF-IDF) statistic, which is commonly used to evaluate how important a word is
to a text in relation to a collection of texts Manning et al. (2008). This
measure considers not only the frequency of words or character $n$-grams in
the text but also the relevancy of those tokens across the dataset as a whole.
We also included other features that we considered useful in recognizing
unhealthy comments, including length of comments, percentage of characters
which are capitalized in each comment, and percentage of punctuation
characters in each comment.

###  4.2 Machine Learning Analysis

In our machine learning experiments of multi-label classification, we
considered the following well-known models:

Logistic regression. We used the Logistic Regression model with TF-IDF
vectorized comment texts using only words for tokens (limited to 10K
features).

Support Vector Machine (SVM). Essentially, SVM focuses on a small subset of
examples that are critical to differentiating between class members and non-
class members, throwing out the remaining examples Vapnik (1998). This is a
crucial property when analyzing large data sets containing many ambiguous
patterns. We used linear kernel since it is robust to overfitting.

LightGBM. LightGBM is a tree-based ensemble model that is trained with
gradient boosting Ke et al. (2017); Barbier et al. (2016); Zhang et al.
(2017). The unique attribute of LightGBM versus other boosted tree algorithms
is that it grows leaf-wise rather than level-wise, meaning that it prioritizes
width over depth. There is an important distinction between boosted tree
models and random forest models. While forest models like Scikit-Learn’s
Pedregosa et al. (2011) _RandomForest_ use an ensemble of fully developed
decision trees, boosted tree algorithms use an ensemble of weak learners that
may be trained faster and can possibly generalize better on a dataset like
this one where there are a very large number of features but only a select few
might have an influence on any given comment. Given the huge disparity between
healthy and unhealthy comments, we used a tree-based
model444https://github.com/microsoft/LightGBM with the top 50 words and the
engineered features.

Convolutional Neural Network Long Short Term Memory (CNN-LSTM) with pre-
trained word embeddings. We used Global Vectors for Word Representation
(GloVe; Pennington et al., 2014b) to create an index of words mapped to known
embeddings by parsing the data dump of pre-trained embeddings. Since the
comments had variable length (range: $[3,250]$ characters), we fixed the
comment length at 250 characters, adding zeros at the end of the sequence
vector for shorter sentences. Next, the embedding layer was used to load the
pre-trained word embedding model. The LSTM layer effectively preserved the
characteristics of historical information in long texts, and the following CNN
layer extracted the local features from the text. After the CNN, we made use
of $globalmaxpooling$ function to reduce the dimensionality of the feature
maps output by the preceding convolutional layer. The pooling layer was
followed by a dense layer (regular deeply connected neural network); there was
also a dropout layer placed between the two dense layers to help regularize
the learning and reduce overfitting of the dataset. We used Tensorflow Abadi
et al. (2016) to implement our CNN-LSTM deep model, whose architecture is
illustrated in Fig. 1. We used binary cross entropy as loss function because
it handles each class as an independent vector (instead of as an 8-dimensional
vector). The input to the model was a random number of samples (represented as
“$?$” in Fig. 1), all having a fixed length of 250 characters.

Figure 1: CNN-LSTM network architecture.

For Logistic Regression, SVM, and LightGBM, we used the implementations
available in Scikit-Learn Pedregosa et al. (2011) with slight modifications to
the default parameters. These models were evaluated using $k$-fold cross-
validation for $k=10$. Importantly, in multi-label classification tasks (our
case), a given comment may be associated with more than one label, so we did
not use traditional stratified $k$-fold sampling which preserves the
distribution of all classes. Instead, we opted to use iterative stratification
Sechidis et al. (2011); Szymański and Kajdanowicz (2017), via the
_IterativeStratification_ method from Scikit-Mulitlearn Szymański and
Kajdanowicz (2017), which gives a well-balanced distribution of evidence of
label relations up to a given order. Owing to the high computational costs of
training a deep neural network, the CNN-LSTM neural network was evaluated with
5-fold cross-validation instead of 10 folds.

The evaluation metrics used in our experiments were micro and macro F1-scores,
and AUC-ROC (i.e., area under the ROC curve). F1-score is defined as the
harmonic mean of precision, a measure of _exactness_ , and recall, a measure
of _completeness_. It is well-suited to handle imbalanced datasets (as in our
case; Han et al., 2011). A macro-average F1-score will compute the F1-score
independently for each class and then take the average (hence treating all
classes equally), whereas a micro-average F1-score will aggregate the
contributions of all classes to compute the average F1-score Zheng (2015).
AUC-ROC curve is a performance measurement for the classification problems at
various threshold settings. ROC is a probability curve and AUC represents the
degree or measure of separability, indicating how much the model is capable of
distinguishing between classes (wherein higher values indicate better
discernment; Zheng, 2015).

We ran multiple experiments with different values of hyper-parameters for
every model. For the logistic regression model, we tested different values of
$n$-grams (words and characters), and max features (words and characters). We
achieved the best results with 10,000 word max-features and word $n$-grams
range between $[1,3]$. For the SVM model, we chose a linear kernel and tested
distinct values of the regularization parameter ($C$); we observed that a
value of $C=0.7$ gave us better results than the default value of $C=1.0$.
During our experiments with LightGBM, we modified some baseline parameters to
better suit the problem at hand: $num\\_{leaves}=128$, $n\\_{estimators}=700$
and $max\\_{depth}=32$.

###  4.3 Sentiment Analysis

We used NLTK VADER (Valence Aware Dictionary for sEntiment Reasoning; Hutto
and Gilbert, 2015) to analyze the polarity of comments. VADER is a lexicon and
rule-based sentiment analysis tool that is specifically attuned to sentiments
expressed in social media. We used the _compound_ value from the result for
analyzing the polarity of the sentiments. For every input text, VADER
normalizes the overall sentiment score to fall within $-1$ (very negative) and
$+1$ (very positive), where scores between $(-0.05,0.05)$ are labeled as
neutral polarity.

##  5 Results & Discussion

In this paper, we analyzed the granularities of subtle toxic online comments.
This section presents our experimental results in detecting the general
sentiments associated with healthy and unhealthy online comments (RQ1) as well
as recognizing such comments via machine learning classifiers (RQ2). Lastly,
we summarize our main takeaways.

###  5.1 Results

Table 2 shows the mean values of the sentiment polarity for each category of
comment. All types of unhealthy comments except _sarcastic_ and
_condescending_ resulted in slight negative scores. The most negative result
was observed for the class hostile, while the most positive result was
obtained from the class sarcastic. The classes condescending and healthy
produced the most neutral sentiment scores.

Table 2: Sentiment Analysis using VADER’s compound score; values range from $-1$ (extremely negative) to $+1$ (extremely positive). Class label | Mean score
---|---
Antagonize | $-0.104498$
Condescending | $-0.035128$
Dismissive | $-0.081356$
Generalization | $-0.085851$
Generalization Unfair | $-0.091320$
Healthy |  $0.035745$
Hostile | $-0.175975$
Sarcastic |  $0.101285$
Table 3: Classification results. Model | Average Micro F1 | Average Macro F1 | AUC-ROC
---|---|---|---
Logistic Regression | 57.54% | 48.31% | 0.51
SVM | 69.15% | 61.29% | 0.62
LightGBM | 64.83% | 52.11% | 0.57
CNN LSTM Network | 88.76% | 67.98% | 0.71
Table 4: AUC-ROC results from the CNN-LSTM model. Class label | ROC-AUC
---|---
Antagonize | 0.7362
Condescending | 0.6702
Dismissive | 0.6311
Generalization | 0.6633
Generalization Unfair | 0.6590
Healthy | 0.9524
Hostile | 0.8141
Sarcastic | 0.5707
Mean | 0.7121

Table 3 exhibits the average micro F1-score, macro F1-score, and ROC-AUC
obtained with all tested classifiers. As can be observed, the best
classification results were achieved with the CNN-LSTM model, followed by SVM
and LightGBM. Table 4 presents the ROC-AUC values resulted from CNN-LSTM (our
best-performing classifier) for all analyzed types of comments. The best
result was observed for the class healthy ($AUC=0.9524$), followed by the
classes hostile ($AUC=0.8141$) and antagonize ($AUC=0.7362$). The class
sarcasm yielded the poorest result ($AUC=0.5707$).

###  5.2 Take-Aways

#### RQ1: What is the general sentiment associated with unhealthy
conversations compared to healthy conversations?

Our sentiment analysis revealed that none of the types of comments (i.e.,
classes) have extremely polarizing sentiment values (Table 2). However, all
the classes except healthy, sarcastic, and _condescending_ have an overall
slightly negative sentiment associated with them, as expected for unhealthy
types of conversations. Hostile comments were the most negative, likely due to
the use of blatantly vulgar and vile language. This could possibly indicate
that hostile comments were less subtle in their hateful content, and thus
easier for sentiment tools and machine learning algorithms to detect.

Antagonizing, dismissive, and generalizing comments all had similar negative
sentiment scores in the range of $[-0.1045,-0.0814]$. Though it is likely
clear to most readers that such comments (examples given in Sec. 3)
demonstrate negative sentiment, both NLTK’s VADER and CNN-LSTM demonstrated
poor results for these classes, which highlights how sentiment tools and
machine learning models may struggle to detect subtle forms of unhealthy
language.

Interestingly, condescending comments scored neutral sentiment ($-0.03513$).
Detecting patronizing and condescending language is still an open research
problem because, amongst many reasons, condescension is often shrouded under
“flowery words” and can itself fall into seven different categories Pérez-
Almendros et al. (2020). Meanwhile, sarcastic comments were notably labeled as
positive sentiment ($0.1013$), even higher than healthy comments ($0.0357$);
this may have been because sarcasm tends to be an ironic remark, often veiled
in a potentially distracting positive tone.

Unhealthy comments were mostly related with a low polarizing negative
sentiment, with _hostile_ comments labeled as the most negative and
_sarcastic_ as the most positive. Healthy comments were associated with
neutral sentiment.

#### RQ2: Can we differentiate unhealthy and healthy conversations? If so,
which type of unhealthy conversation is the most detectable one?

From Table 3, we can see that it was possible to differentiate between
unhealthy comments with a maximum micro F1-score, macro F1-score, and ROC-AUC
of 88.76%, 67.98%, and $0.7121$, respectively, using the CNN-LSTM model. The
remaining models tested (Logistic Regression, SVM, and LightGBM) reached
poorer performances. All tested models reported a lower average macro F1-score
compared to the micro F1-score results, which is intuitive given the highly
imbalanced dataset—note that macro F1-score gives the same importance to each
class, i.e., this value is low for models that perform poorly on rare classes,
which was the case for CNN-LSTM when analyzing unhealthy conversation classes.
Therefore, it is possible to speculate that the other models also performed
better when recognizing healthy comments compared to unhealthy ones.

Additionally, Table 4 shows that healthy comments can be differentiated from
the remaining classes relatively well with generally high predictive accuracy
($AUC_{healthy}=0.9524$), likely due to the high number of healthy samples in
the dataset. In contrast, despite only 1,130 samples associated with the
hostile class, $AUC_{hostile}=0.8141$, which was the second-highest AUC
achieved by our top performer classifier. Most of the hostile comments have
explicit language, which might make it easier for the classifier to properly
recognize this type of conversation. The AUC for antagonizing comments was the
third-highest achieved, at $0.7362$, potentially because
$n_{antagonize}=2,066$ was the second largest sample size out of the remaining
unhealthy conversations categories; antagonize also achieved the second most
negative mean sentiment score ($-0.1045$), further indicating that there may
be characteristics of this class that facilitate detection from machine
learning algorithms.

Detection of sarcasm was the most difficult for the CNN-LSTM model
($AUC_{sarcasm}=0.5707$). There have been numerous studies which have faced
similar issues with detection of sarcasm given the difficulty of understanding
the nuances and context surrounding sarcastic texts Poria et al. (2016); Zhang
et al. (2016). The AUC scores for condescending, dismissive, and generalizing
comments were only slightly better (range: $[0.6590,0.6702]$), again
highlighting the difficulty in detecting such nuanced and subtle language.

Healthy online comments were accurately distinguished from unhealthy ones.
Hostile comments were easier to detect than other forms of unhealthy
conversations.

##  6 Limitations & Future Work

This section discusses the limitations of our study, and suggests possible
future work.

We leveraged the Price et al. (2020) dataset, which sampled comments from the
opinions section of the Canadian Globe and Mail news website. Though our
results are promising (with top average micro and macro F1-scores of 88.76%
and 67.98%, respectively), this dataset is nonetheless contained in a highly
specific context (data was collected from a single Canadian newspaper
website), which likely decreases the generalizability of our results. The
dataset was also notably imbalanced, where most of the labels were attributed
to healthy comments. Another limitation of the dataset is the low inter-
reliability among the coders (Table 1). The low values of the metric reduce
the confidence in the dataset, but also suggests that identification of
different types of unhealthy conversations is challenging even for humans.
Also, Krippendorff’s $\alpha$ was not reported for two out of eight classes
(generalization unfair and healthy). In future work, we thus aim to expand our
experiments on a more diverse dataset by replicating Prince et al.’s coding
process using a variety of comments from different news websites.

One limitation of our machine learning analysis is that we trained a deep
learning architecture (CNN-LSTM) using a relatively small dataset, mainly in
terms of unhealthy categories of conversations. In future work, we plan to
increase the number of unhealthy comments of our analysis by using data
augmentation techniques such as Generative Adversarial Networks (GAN), which
can synthetically generate new comments. NLP data augmentation techniques
could also be used to increase the dataset without requiring significant human
supervision, such as simulating keyboard distance error, substituting words
according to their synonyms/antonyms, replacing words with their common
spelling mistakes, etc. Şahin and Steedman (2019). This may help increase the
performance of machine learning classifiers in general.

Another limitation is that we included only four classifiers in our analysis,
which may restrict the generalizability of our findings. Future work is
therefore advised to include other models successfully used by previous
studies in classifying conversations with unhealthy and toxic elements, such
as RandomForest, Bi-LSTM networks, Stacked Bi-LSTM Bagga (2020), capsule
networks Srivastava et al. (2018) and transformer models including BERT Price
et al. (2020). Future work is also advised to test feature selection methods,
which usually help increase classification accuracy by focusing on the most
discriminating features while discarding redundant and irrelevant information.
Lastly, given the challenging nature of unhealthy comments classification
tasks, future work should look at specialized corpora (e.g., Wang and Potts,
2019; Oraby et al., 2017) and machine learning models trained at
differentiating particular types of conversations, for example, solely
sarcastic comments from non-sarcastic ones (e.g., Dadu and Pant, 2020;
Hazarika et al., 2018).

##  7 Conclusion

This paper analyzed the granularities of subtle toxic online conversations.
The study goal was to systematically investigate the general sentiment
associated with healthy and unhealthy online comments, as well as the accuracy
of machine learning classifiers in recognizing these comments. Towards this
end, we leveraged a public dataset containing healthy and unhealthy comments
labeled with seven forms of subtle toxicity. We were able to distinguish
between these comments with a maximum micro F1-score, macro F1-score, and AUC-
ROC of 88.76%, 67.98%, and 0.71, respectively, using a CNN-LSTM network with
pre-trained word embeddings. Our conclusions are two-fold: (i) hostile
comments are the most negative (i.e., less subtle toxic) and detectable form
of unhealthy online conversation; (ii) most types of unhealthy comments are
associated with a slight negative sentiment. Findings from this work have the
potential to inform and advance future research and development of online
moderation tools, which pave the way for safer online environments.

## References

  * Abadi et al. (2016) Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. 2016.  TensorFlow: Large-scale machine learning on heterogeneous systems.  _arXiv preprint arXiv:1603.04467_.  Software available from tensorflow.org.
  * van Aken et al. (2018) Betty van Aken, Julian Risch, Ralf Krestel, and Alexander Löser. 2018.  Challenges for toxic comment classification: An in-depth error analysis.  _arXiv:1809.07572 [cs]_.  ArXiv: 1809.07572.
  * Bagga (2020) Sunyam Bagga. 2020.  Detecting abuse on the internet: It’s subtle.  _McGill University_ , page 105.
  * Barbier et al. (2016) Jean Barbier, Mohamad Dia, Nicolas Macris, Florent Krzakala, Thibault Lesieur, and Lenka Zdeborová. 2016.  Mutual information for symmetric rank-one matrix estimation: A proof of the replica formula.  In _Advances in Neural Information Processing Systems_ , volume 29. Curran Associates, Inc.
  * Blackwell et al. (2017) Lindsay Blackwell, Jill Dimond, Sarita Schoenebeck, and Cliff Lampe. 2017.  Classification and its consequences for online harassment: Design insights from heartmob.  _Proceedings of the ACM on Human-Computer Interaction_ , 1(CSCW):24:1–24:19.
  * Chen and Qian (2019) Zhuang Chen and Tieyun Qian. 2019.  Transfer capsule network for aspect level sentiment classification.  In _Proceedings of the 57 th Annual Meeting of the Association for Computational Linguistics_, pages 547–556. Association for Computational Linguistics.
  * Chu et al. (2016) Theodora Chu, Kylie Jue, and Max Wang. 2016.  Comment abuse classification with deep learning.  _Stanford University_.
  * Dadu and Pant (2020) Tanvi Dadu and Kartikey Pant. 2020.  Sarcasm detection using context separators in online discourse.  In _Proceedings of the Second Workshop on Figurative Language Processing_ , pages 51–55.
  * Davidson et al. (2017) Thomas Davidson, Dana Warmsley, Michael Macy, and Ingmar Weber. 2017.  Automated hate speech detection and the problem of offensive language.  _arXiv:1703.04009 [cs]_.  ArXiv: 1703.04009.
  * Dinakar et al. (2012) Karthik Dinakar, Birago Jones, Catherine Havasi, Henry Lieberman, and Rosalind Picard. 2012.  Common sense reasoning for detection, prevention, and mitigation of cyberbullying.  _ACM Transactions on Interactive Intelligent Systems_ , 2(3):1–30.
  * Georgakopoulos et al. (2018) Spiros V. Georgakopoulos, Sotiris K. Tasoulis, Aristidis G. Vrahatis, and Vassilis P. Plagianakos. 2018.  Convolutional neural networks for toxic comment classification.  _arXiv:1802.09957 [cs]_.  ArXiv: 1802.09957.
  * Glick and Fiske (2001) Peter Glick and Susan T. Fiske. 2001.  An ambivalent alliance: Hostile and benevolent sexism as complementary justifications for gender inequality. _American psychologist_ , 56(2):109–118.
  * Guberman and Hemphill (2017) Joshua Guberman and Libby Hemphill. 2017.  Challenges in modifying existing scales for detecting harassment in individual tweets.  In _Proceedings of 50th Annual Hawaii International Conference on System Sciences (HICSS)_.
  * Han et al. (2011) Jiawei Han, Micheline Kamber, and Jian Pei. 2011.  Data mining concepts and techniques, third edition.  _The Morgan Kaufmann Series in Data Management Systems_ , 5(4):83–124.
  * Hazarika et al. (2018) Devamanyu Hazarika, Soujanya Poria, Sruthi Gorantla, Erik Cambria, Roger Zimmermann, and Rada Mihalcea. 2018.  CASCADE: Contextual sarcasm detection in online discussion forums.  In _Proceedings of the 27th International Conference on Computational Linguistics_ , pages 1837–1848, Santa Fe, New Mexico, USA. Association for Computational Linguistics.
  * Hutto and Gilbert (2015) C. J. Hutto and Eric Gilbert. 2015.  Vader: A parsimonious rule-based model for sentiment analysis of social media text.  In _Proceedings of the 8 th International Conference on Weblogs and Social Media, ICWSM 2014_.
  * Jha and Mamidi (2017) Akshita Jha and Radhika Mamidi. 2017.  When does a compliment become sexist? analysis and classification of ambivalent sexism using twitter data.  In _Proceedings of the Second Workshop on NLP and Computational Social Science_ , page 7–16. Association for Computational Linguistics.
  * Jurgens et al. (2019) David Jurgens, Eshwar Chandrasekharan, and Libby Hemphill. 2019.  A just and comprehensive strategy for using nlp to address online abuse.  _arXiv:1906.01738 [cs]_.  ArXiv: 1906.01738.
  * Ke et al. (2017) Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. 2017.  Lightgbm: A highly efficient gradient boosting decision tree.  In _Advances in Neural Information Processing Systems_ , volume 30. Curran Associates, Inc.
  * Kolhatkar et al. (2020) Varada Kolhatkar, Hanhan Wu, Luca Cavasso, Emilie Francis, Kavan Shukla, and Maite Taboada. 2020.  The sfu opinion and comments corpus: A corpus for the analysis of online news comments.  _Corpus Pragmatics_ , 4(2):155–190.
  * Le and Mikolov (2014) Quoc V. Le and Tomas Mikolov. 2014.  Distributed representations of sentences and documents.  _arXiv:1405.4053 [cs]_.  ArXiv: 1405.4053.
  * Liu et al. (2018) Ping Liu, Joshua Guberman, Libby Hemphill, and Aron Culotta. 2018.  Forecasting the presence and intensity of hostility on instagram using linguistic and social features.  _arXiv:1804.06759 [cs]_.  ArXiv: 1804.06759.
  * Manning et al. (2008) Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schütze. 2008.  _Introduction to Information Retrieval_.  Cambridge University Press, New York, NY, USA.
  * Markey (2000) P. M. Markey. 2000.  Bystander intervention in computer-mediated communication.  _Computers in Human Behavior_ , 16(2):183–188.
  * Mikolov et al. (2013) Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013.  Efficient estimation of word representations in vector space.  _arXiv:1301.3781 [cs]_.  ArXiv: 1301.3781.
  * Nadal et al. (2014) Kevin L. Nadal, Katie E. Griffin, Yinglee Wong, Sahran Hamit, and Morgan Rasmus. 2014.  The impact of racial microaggressions on mental health: Counseling implications for clients of color.  _Journal of Counseling & Development_, 92(1):57–66.
  * Oraby et al. (2017) Shereen Oraby, Vrindavan Harrison, Lena Reed, Ernesto Hernandez, Ellen Riloff, and Marilyn Walker. 2017.  Creating and characterizing a diverse corpus of sarcasm in dialogue.  _arXiv preprint arXiv:1709.05404_.
  * Parekh and Patel (2017) Pooja Parekh and Hetal Patel. 2017.  Toxic comment tools: A case study.  _International Journal of Advanced Research in Computer Science_ , 8(5).
  * Pedregosa et al. (2011) F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. 2011.  Scikit-learn: Machine learning in Python.  _Journal of Machine Learning Research_ , 12:2825–2830.
  * Pennebaker et al. (2001) James W. Pennebaker, Martha E. Francis, and Roger J. Booth. 2001.  _Linguistic Inquiry and Word Count_.  Lawerence Erlbaum Associates, Mahwah, NJ.
  * Pennington et al. (2014a) Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014a.  Glove: Global vectors for word representation.  In _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , page 1532–1543. Association for Computational Linguistics.
  * Pennington et al. (2014b) Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014b.  Glove: Global vectors for word representation.  In _Empirical Methods in Natural Language Processing (EMNLP)_ , pages 1532–1543.
  * Poria et al. (2016) Soujanya Poria, Erik Cambria, Devamanyu Hazarika, and Prateek Vij. 2016.  A deeper look into sarcastic tweets using deep convolutional neural networks.  _arXiv preprint arXiv:1610.08815_.
  * Price et al. (2020) Ilan Price, Jordan Gifford-Moore, Jory Flemming, Saul Musker, Maayan Roichman, Guillaume Sylvain, Nithum Thain, Lucas Dixon, and Jeffrey Sorensen. 2020.  Six attributes of unhealthy conversation.  _arXiv:2010.07410 [cs]_.  ArXiv: 2010.07410.
  * Pérez-Almendros et al. (2020) Carla Pérez-Almendros, Luis Espinosa-Anke, and Steven Schockaert. 2020.  Don’t patronize me! an annotated dataset with patronizing and condescending language towards vulnerable communities.  _arXiv preprint arXiv:2011.08320_.
  * Qiufen (2014) Yu Qiufen. 2014.  Understanding the impact of culture on interpretation: A relevance theoretic perspective.  _Intercultural Communication Studies_ , 23(3).
  * Saeed et al. (2018) H. H. Saeed, K. Shahzad, and F. Kamiran. 2018.  Overlapping toxic sentiment classification using deep neural architectures.  In _2018 IEEE International Conference on Data Mining Workshops (ICDMW)_ , page 1361–1366.
  * Safi Samghabadi et al. (2017) Niloofar Safi Samghabadi, Suraj Maharjan, Alan Sprague, Raquel Diaz-Sprague, and Thamar Solorio. 2017.  Detecting nastiness in social media.  In _Proceedings of the First Workshop on Abusive Language Online_ , page 63–72. Association for Computational Linguistics.
  * Şahin and Steedman (2019) Gözde Gül Şahin and Mark Steedman. 2019.  Data augmentation via dependency tree morphing for low-resource languages.  _arXiv preprint arXiv:1903.09460_.
  * Saif et al. (2018) Mujahed A. Saif, Alexander N. Medvedev, Maxim A. Medvedev, and Todorka Atanasova. 2018.  Classification of online toxic comments using the logistic regression and neural networks models.  _AIP Conference Proceedings_ , 2048(1):060011.
  * Salminen et al. (2018) Joni Salminen, Hind Almerekhi, Milica Milenkovic, Soon-Gyo Jung, Jisun An, Haewoon Kwak, and Jim Jansen. 2018.  Anatomy of online hate: Developing a taxonomy and machine learning models for identifying and classifying hate in online news media.  In _Proceedings of the International AAAI Conference on Web and Social Media_ , volume 12.
  * Sechidis et al. (2011) Konstantinos Sechidis, Grigorios Tsoumakas, and Ioannis Vlahavas. 2011.  On the stratification of multi-label data.  _Machine Learning and Knowledge Discovery in Databases_ , pages 145–158.
  * Sennrich et al. (2016) Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016.  Controlling politeness in neural machine translation via side constraints.  In _Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_ , pages 35–40.
  * Srivastava et al. (2018) Saurabh Srivastava, Prerna Khurana, and Vartika Tewari. 2018.  Identifying aggression and toxicity in comments using capsule network.  In _Proceedings of the First Workshop on Trolling, Aggression and Cyberbullying (TRAC-2018)_ , pages 98–105, Santa Fe, New Mexico, USA. Association for Computational Linguistics.
  * Sue et al. (2007) Derald Wing Sue, Christina M. Capodilupo, Gina C. Torino, Jennifer M. Bucceri, Aisha M. B. Holder, Kevin L. Nadal, and Marta Esquilin. 2007.  Racial microaggressions in everyday life: Implications for clinical practice. _American psychologist_ , 62(4):271–286.
  * Szymański and Kajdanowicz (2017) P. Szymański and T. Kajdanowicz. 2017.  A scikit-based Python environment for performing multi-label classification.  _ArXiv e-prints_.
  * Szymański and Kajdanowicz (2017) Piotr Szymański and Tomasz Kajdanowicz. 2017.  A network perspective on stratification of multi-label data.  In _Proceedings of the First International Workshop on Learning with Imbalanced Domains:Theory and Applications_ , volume 74 of _Proceedings of Machine Learning Research_ , pages 22–35, ECML-PKDD, Skopje, Macedonia. PMLR.
  * Vapnik (1998) Vladimir N. Vapnik. 1998.  _Statistical Learning Theory_.  Wiley-Interscience.
  * Wang and Potts (2019) Zijian Wang and Christopher Potts. 2019.  Talkdown: A corpus for condescension detection in context.  _arXiv preprint arXiv:1909.11272_.
  * Waseem et al. (2017) Zeerak Waseem, Thomas Davidson, Dana Warmsley, and Ingmar Weber. 2017.  Understanding abuse: A typology of abusive language detection subtasks.  In _Proceedings of the First Workshop on Abusive Language Online_ , page 78–84. Association for Computational Linguistics.
  * Yin et al. (2009) Dawei Yin, Zhenzhen Xue, Liangjie Hong, Brian Davison, April Edwards, and Lynne Edwards. 2009.  Detection of harassment on web 2.0.  _Proceedings of the Content Analysis in the WEB_ , 2:1–7.
  * Yu et al. (2017) Liang-Chih Yu, Jin Wang, K. Robert Lai, and Xuejie Zhang. 2017.  Refining word embeddings for sentiment analysis.  In _Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing_ , page 534–539. Association for Computational Linguistics.
  * Zhang et al. (2017) Huan Zhang, Si Si, and Cho-Jui Hsieh. 2017.  Gpu-acceleration for large-scale tree boosting.  _arXiv preprint arXiv:1706.08359_.
  * Zhang et al. (2016) Meishan Zhang, Yue Zhang, and G. Fu. 2016.  Tweet sarcasm detection using deep neural network.  In _COLING_.
  * Zheng (2015) A. Zheng. 2015.  _Evaluating Machine Learning Models: A Beginner’s Guide to Key Concepts and Pitfalls_.  O’Reilly Media.


Muhammad Mahmudul Hasan, Jonathan A. Cumming 11institutetext: Department of
Mathematical Sciences, Durham University, Durham, UK
11email<EMAIL_ADDRESS>
11email<EMAIL_ADDRESS>
# Bayes Linear Emulation of Simulated Crop Yield

Muhammad Mahmudul Hasan  Jonathan A. Cumming

###### Abstract

The analysis of the output from a large-scale computer simulation experiment
can pose a challenging problem in terms of size and computation. We consider
output in the form of simulated crop yields from the Environmental Policy
Integrated Climate (EPIC) model, which requires a large number of inputs -
such as fertiliser levels, weather conditions, and crop rotations - inducing a
high dimensional input space. In this paper, we adopt a Bayes linear approach
to efficiently emulate crop yield as a function of the simulator fertiliser
inputs. We explore emulator diagnostics and present the results from emulation
of a subset of the simulated EPIC data output.

###### keywords:

Bayes linear methods, Emulation, Computer simulation, Yield modelling

##  1 Introduction

The use of computer simulations to model complex systems has become
increasingly popular, with applications spanning many areas of scientific
study. The Environmental Policy Integrated Climate (EPIC) model [1] is one
such example, constructed to explore and simulate the behaviour of various
crops over time in response to key inputs such as crop rotation, fertilizer
levels, land management, weather conditions, and other environmental
variables. Consideration of the simulator behaviour in response to such a
large number of inputs is a challenging and high-dimensional problem. An
effective strategy to model such simulator output is through the use of an
emulator, which acts as a statistical surrogate for the computationally
expensive computer simulation. In this paper, we explore emulator construction
and diagnostics for a subset of output from the EPIC simulation, with a view
to developing our understanding of yield trend corresponding to fertilizers
inputs.

##  2 The Simulator

The scope and scale of EPIC’s behaviour and outputs are quite complex,
encompassing: (i) crop rotation - the sequence of crops planted and harvested
during the run of the simulation; (ii) fertilizer inputs - the levels of
nitrogen and phosphorous applied during the simulation; (iii) land
characteristics - encapsulated in the form of different soils and land
steepness; and (iv) weather - while not an input that can be controlled, a
variety of historical weather scenarios are applied. Evaluation of the
simulator then outputs a time series of various attributes relating to the
crop and land conditions throughout a 60-year simulation. For this analysis,
we focus on the annual reported yield for each of the crops of interest, thus
our simulated data reduces to the form of a single simulated yield for each
combination of input variables. For our analysis, we will focus on the
continuous fertiliser inputs of nitrogen ($N$) and phosphorus ($P$) levels,
which were simulated over a discrete grid of values, each with 13 values over
[0, 100]. Thus, for a given crop and fixed combination of land and weather
variables, we obtain a grid of 169 simulated yields, $Y$, in response to $N$
and $P$. Examples of such yield responses are shown in Fig. 1, plotting only
the marginal response of spring barley yield to $N$. We note the common
feature of a monotone increasing yield in response to increased fertilisation,
however, we observe a number of simulations deviate from this expected pattern
being either constant or changing suddenly.

Figure 1: Left panel: Line plot for the 1250 unique combinations of spring
barley data with respect to nitrogen fertilizer; Right panel: Line plot for 15
different small unique combinations to assess the clear trend of the data.

##  3 Methodology

###  3.1 Bayes linear methods

In Bayesian inference, data is used to update beliefs about random quantities
of interest - typically represented via probability distributions. The
Bayesian approach typically combines a parametric model for the data in the
form of the likelihood with a prior probability distribution over the model’s
parameters to produce a posterior distribution for those parameters given the
data. This fully probabilistic approach poses a number of practical
challenges: the first being making a meaningful prior specification, and the
second being computational issues in obtaining or simulating from the
posterior distributions.

An alternative approach follows the concept of de Finetti [2], where we
consider belief specifications in terms of expectation rather than
probability. This is known as a _Bayes linear approach_ , and it operates
based on means and variances. The fundamental Bayesian update can then be
compactly expressed by the following two equations [3]:

$\displaystyle E_{D}[B]$ $\displaystyle=$ $\displaystyle
E[B]+Cov[B,D]Var[D]^{-1}(D-E[D])$ (1) $\displaystyle Var_{D}[B]$
$\displaystyle=$ $\displaystyle Var[B]-Cov[B,D]Var[D]^{-1}Cov[D,B]$ (2)

where prior beliefs about random quantities $B$ are updated given data $D$. A
key advantage to this approach to Bayesian inference is the elimination of the
need for complex sampling schemes to investigate the posterior distributions,
as posterior means and variances can be found directly via the equations
above. Additionally, without the need to specify full distribution forms for
our priors the task of the prior specification is also less complex. However,
the key consequence of this and the primary limitation of this approach is
that we have potentially sacrificed the richness of the information provided
by operating with probability distributions.

###  3.2 Emulation

For our problem, we will treat each collection of simulated yields as
functions of $N$ and $P$. As the functional form of the simulated yield
response to $N$ in Fig. 1 is not consistent with a single parametric model, we
will use a statistical emulator to model the relationship between the inputs
from the simulator to the outputs. The general form of an emulator is based
around a combination of a regression surface with correlated and uncorrelated
errors as follows:

$\displaystyle f(x)=\sum_{i=1}^{p}\beta_{i}g_{i}(x)+u(x)$ (3)

where $\sum_{i=1}^{p}\beta_{i}g_{i}(x)$ represents the mean function in a
regression form, expressed in terms of the input variables, $x$. The
parameters $\beta_{i}$ are unknown scalar regression coefficients
corresponding to the regression basis functions for the active inputs
$g_{i}(x)$. The final component is then $u(x)$, which is a zero-mean weakly
stationary process to explain additional variation around the mean function in
terms of $x$. To complete the model specification, we require a covariance
function for the residual process $u(x)$, which typically has a Gaussian form:

$\displaystyle
Cov[u(x_{1}),u(x_{2})]=\sigma^{2}\exp[-\theta|x_{1}-x_{2}|^{2}]$ (4)

for any pair of inputs $x_{1}$ and $x_{2}$, with a correlation length
parameter $\theta$ and variance $\sigma^{2}$. To construct our Bayes linear
emulator [4], we structure the mean function as a simple regression in terms
of the simple basis $[1,N,P]$. Thus, from the equation (3) we can write as
$E[f(x)]=E[\beta_{0}]+E[\beta_{1}]N+E[\beta_{2}]P$, in terms of three
regression coefficients $\beta_{0},\beta_{1},\beta_{2}$. Prior expectations
and variances for these coefficients and $\sigma^{2}$ were assigned to the
corresponding least-squares estimates over the training data set. The
correlation length parameters for $N$ and $P$ were assigned to a value of
0.015 after investigation via cross-validation, and to reflect a common level
of smoothness of yield in response to both inputs.

###  3.3 Emulator diagnostics

To assess the quality of our emulator, we can compute various diagnostics.
First, the resolution [4] of the Bayes linear update can be expressed as,

$\displaystyle R_{D}[f(x)]=1-\frac{Var_{D}[f(x)]}{Var[f(x)]}$ (5)

The resolution lies between 0 and 1, and functions much like a classical
$R^{2}$ where that resolution values close to 1 indicate a high proportion of
the variation has been explained. Secondly, the standardized prediction errors
(SPE) [4] for a simulation value $Y$ with corresponding inputs $x$ can be
expressed as,

$\displaystyle SPE=\frac{Y-E_{D}[f(x)]}{\sqrt{Var_{D}(f(x))}}$ (6)

Large values of SPE indicate a clear conflict between the emulator and
simulator, indicative of deficiencies in the fit of the emulator or surprising
simulator output values. In general, values of (6) of absolute value greater
than $3$ are used to identify such problems [4].

##  4 Results and Discussion

For our analysis, we present results from a subset of crops, namely maize and
spring barley. For each crop, our simulations are structured we have 1250
simulations of yield corresponding to different simulation conditions, each of
which explores a 13Ã-13 grid of combinations of the two fertiliser inputs, $N$
and $P$. Focussing on a single grid of simulated yield, we construct a Bayes
linear emulator based on a simple regression (3) and a correlated error with
covariance function (4) using 80% of the available data, reserving the
remaining 20% for testing and diagnostics.

The emulator is updated from the training data via the Bayes linear formulae
(1) and (2), with results shown in Fig. 2. The left and centre panels show the
emulated mean maize yield and its associated standard deviation as functions
of $N$ and $P$. We note that the crop yield is increasing with increasing
Nitrogen levels, though the effect of Phosphorous is much less pronounced and
arguably only important when levels of Nitrogen are low. The standard
deviation plot highlights low levels of uncertainty in mean maize yield around
the locations for which we have simulations, with uncertainty increasing as we
move away from these points. The right panel shows the emulated mean yield for
spring barley, where we note that the weak dependency on Phosphorous has now
disappeared entirely and the crop yield appears insensitive to values of $P$.

Diagnostic plots for the emulation of maize yield are given in Figure 3. The
plot of the emulator resolution (left) displays high values (greater than 0.7)
over much of the space, indicating the emulator has explained much of the data
variability. The blue regions of low resolution indicate locations
corresponding to the test data, which were not used for emulator fitting,
hence little data was available to reduce the variance in these locations.
Standardised prediction errors are shown in the centre and right panels of
Fig. 3, and we note that all points lie within Â±2, suggesting a high degree
of consistency and agreement between emulator and simulator.

Figure 2: Left: emulated mean maize yield as a function of Nitrogen ($x_{1}$)
and Phosphorus ($x_{2}$); middle: emulator standard deviation for maize yield;
right: emulated mean spring barley yield. Figure 3: From left to right: plot
of resolution (5) of the Bayes linear update; standardised prediction error
for test data on the maize yield emulator as a function of $N$; standardised
prediction error for test data on the maize yield emulator as a function of
$P$.

##  5 Concluding Remarks

Emulation is an effective tool for modelling computer simulations, where a
parametric model of the simulator’s response to changes in inputs may not be
known a priori. For data such as these EPIC simulations, the shape of the
yield response was not consistent between simulations necessitating an
emulation-based approach where the yield response could be determined from
prior information and the simulation output itself. A fully Bayesian approach
would require distributional specifications for each of the parameters in such
an emulator and simulation-based methods for any subsequent inference, which
becomes challenging when dealing with computer models with large numbers of
outputs. For our analysis, we adopted a Bayes linear approach which simplified
the computation and complexity in fitting the model substantially, while still
providing a powerful tool for modelling and analysing the computer model
output. Additionally, the emulator’s quality and performance can be readily
assessed and monitored through the use of appropriate diagnostics. Looking
ahead, a natural progression from this work is to broaden the input space and
consider the effects of the entire collection of simulator inputs - including
both continuous and categorical variables.

## References

  * [1] Williams, J.R., Jones, C.A., Kiniry, J.R. and Spanel, D.A: The EPIC crop growth model. Transactions of the ASAE, vol. 32(2), pp.497-0511 (1989). doi:10.13031/2013.31032
  * [2] De Finetti B.: Theory of probability: a critical introductory treatment. Vol. 6. John Wiley & Sons (2017).
  * [3] Goldstein, M. and Wooff, D.: Bayes linear statistics: Theory and methods. Vol. 716. John Wiley & Sons (2007).
  * [4] Cumming, J.A. and Goldstein, M.: Bayes linear Uncertainty Analysis for Oil Reservoirs Based on Multiscale Computer Experiments. In: The Oxford Handbook of Applied Bayesian Analysis, pp. 241-270 A. O’Hagan & M. West (2010).

##  6 Appendix

###  6.1 R code for Bayes Linear Emulation

R code implementation of our methods is available at
https://sites.google.com/d/1siopGfjK_btE99h2TU2BGfwzgEn8szeA/p/1NjQxo2ti4d23Hc8zIeXP0Py0NsXVzHpK/edit.