extfieldsofstudy:
Computer Science
Engineering

text:
Scene Classification in Indoor Environments for Robots using Context Based Word Embeddings

Scene Classification has been addressed with numerous techniques in computer vision literature. However, with the increasing number of scene classes in datasets in the field, it has become difficult to achieve high accuracy in the context of robotics. In this paper, we implement an approach which combines traditional deep learning techniques with natural language processing methods to generate a word embedding based Scene Classification algorithm. We use the key idea that context (objects in the scene) of an image should be representative of the scene label meaning a group of objects could assist to predict the scene class. Objects present in the scene are represented by vectors and the images are re-classified based on the objects present in the scene to refine the initial classification by a Convolutional Neural Network (CNN). In our approach we address indoor Scene Classification task using a model trained with a reduced pre-processed version of the Places365 dataset and an empirical analysis is done on a real-world dataset that we built by capturing image sequences using a GoPro camera. We also report results obtained on a subset of the Places365 dataset using our approach and additionally show a deployment of our approach on a robot operating in a real-world environment.

I. INTRODUCTION Scene Classification has been extensively researched by the computer vision [1], [2], [3] community. Most datasets have millions of images which makes the task challenging and thereby encourages the vision community to come up with better algorithms to achieve higher accuracies. However, on some of these datasets, current state of the art algorithms have low accuracies which renders their usage in the real world impractical. For instance the top-1 accuracy on the Places365 dataset [1] is only around 56%. Such an accuracy is not of much use when deploying algorithms on a robot as nearly half of the time the robot would make erroneous predictions. In the past, there have been datasets with a limited number of different places, like [4], [5], which had only upto 17 places, however these datasets' usage has been rendered obsolete due to already achieved near human accuracy (≈95%).
In this paper, we propose an approach for Scene Classification in real time in the context of robotics. We primarily target indoor scenes in this paper. In indoor environments, GPS cannot be relied on for metric level precision. We can only get a rough estimate of the position of the robot from GPS in indoor scenes. We leverage this inaccuracy in the GPS to reduce the search space of the places. We propose a taxonomy based approach to perform Scene Classification by dividing the places according to the area type (e.g., school, shopping-mall, home, etc.). Once we know roughly which region the robot is in, we need to only search for a subset of places rather than searching all the classes. For example, from GPS we can know that the robot is in a school environment. This would reduce the search space to places like corridors, lecture hall, seminar room, washroom, etc. (see table I). We no longer need to consider the places that belong to any unrelated class like living room, pet shop, jewelry store, forest, waterfall, mountains, etc. After this step, many classes are pruned leaving a smaller set of candidate classes to select from. To classify the places, we propose to use different CNN models for each of the indoor areas present in the Places365 dataset [1].
After employing a CNN for Scene Classification, we obtain the top-5 predictions for a given image. To further refine the accuracy of the prediction, we make use of different objects present in the scene which are detected using a Scene Parsing Module (see Figure 2). Each object present in the image is represented using a word-embedding [6]. In most cases, these object embeddings are similar for objects belonging to a particular scene and the scene embedding itself, e.g., tray, coffee table, chairs in a dinning room (See Figure 1) should have similar embedding. Using these embeddings, we further refine the top-5 scores to improve the accuracy. Finally, we build our own test dataset to validate our approach as there are many inconsistencies in Fig. 2. Overview of our algorithm. Our approach takes an RGB image as input. Then passes it onto two CNN modules. The top module is for Scene Classification, which gives us an initial top-5 prediction. The bottom module is for Scene Parsing, which detects the scene contents including background (window pane, plant, etc.) and foreground (table, chair, sofa, etc.) objects. The Word Vectors Module computes a vector for the contents of the image, and a vector for each of the top-5 predicted labels. Then Word Vectors Module refines the ranking of these top-5 predicted labels by comparing the vector similarity. the Places365 dataset as described in section IV. We also report the performance on a subset of the Places365 dataset.
The major contributions of this work are: (i) A taxonomy based approach to make Scene Classification work in real time with high accuracy for robots using GPS information, (ii) An empirical evaluation showing performance of our proposed approach, (iii) A real world dataset for the task of indoor Scene Classification. The paper is structured as follows: we describe the relevant work in Section II. Section III describes our proposed approach. Section IV describes our test dataset. Experimental results of our approach are described in Section V and finally we conclude our work in Section VI.

II. RELATED WORK
In this section, we give a brief overview of the existing approaches used for Scene Classification. Li et al. [7] used object detectors as features to form an Object Bank Representation to assist Scene Classification. Our proposed approach is similar to [7], instead of using an Object Bank representaion, we employed a word vector [6] based feature representation to find similarities between objects in the image and the scene category. Yang et al. [8] used key point detection to create feature vectors. Bosch et al. [9] used visual vocabulary as features to train a Support Vector Machine (SVM) classifier. Furthermore, different types of CNN architectures (AlexNet [10], VGG [11], GoogleNet [12]) were used in Scene Classification recently. These CNNs achieved decent state-of-the-art performance (≈56%) on Places365 [1] dataset. As well as, Khan et al. [13] integrated Places-VGG with Spectral Features to improve Scene Classification. However, the datasets they used are not appropriate for real world application.
The CNN generally learns a feature representation of an image but the network can not tell us the object relations in the image. However, a special CNN architecture (Seg-Net [14]) can be used to perform pixel level segmenta-tion (Scene Parsing). A newly released pre-trained CNN model [15] based on a cascade segmentation module can find 150 types of contents in an image, which includes background (wall, doors, windows, floor, etc.) and foreground (person, television, table, chair, etc.) information. There are several approaches which can detect objects in an image; YOLO [16] detects most of the foreground objects. But their approach does not yield anything about the background of the image. Background information also plays an important role when a human is classifying a scene.
Word vectors [17] are very popular in Natural Language Processing (NLP). This is also known as word embedding. It improves the performance of LSTM-CRF [18] significantly on the named entity recognition systems without any language-specific knowledge [19]. Word vectors were trained to learn the vector representation of a given vocabulary. Word vectors have been used in many domains like sentiment analysis [6], detecting magnitude of events [20], named entity recognition [21], etc.
Scene Classification can also be useful for Place Recognition as it reduces the search space. Alternatively Place recognition can also be used to tackle scene classification (in case where all test images come from a set of predefined paces and each place is associated with a scene type). Some of the existing Place recognition works include [3], [22], [4], [23].
Data sets: Many well-known data sets and benchmarks exist. For instance, Places88 [24] is the very first version of MIT Places benchmark 3 . It has 88 scene categories. The latest Scene Classification data set is MIT Place365 [1], which has 365 scene categories. In this paper we use Place365 as our training and evaluation data-set, as it is the largest scene classification data-set, and it contains broad categories. Some other old datasets also exist for Scene Classification. The Pascal VOC [25] data set has scene context annotations which are used for object detection and object segmentation tasks. Another data set is MS-COCO [26]. COCO is mainly used for instance detection and scene segmentation. The pre-trained CNN Scene Parsing model [15] used in this paper is trained on COCO.

III. APPROACH
Our aim is to provide a Scene Classification approach which can perform well in a known real world environment (e.g., school, home, shopping mall). We build a taxonomy of different environments each containing separate scenes as shown in Table I. We pre-process the Places365 dataset to clean and reduce it to have only sensible indoor places for our use. Places365 has many inconsistencies as described in section IV.
We use two existing CNN models, one for Scene Classification [1] and the other for Scene Parsing [15]. Figure 2 shows the overview of our approach. The input is an RGB image for the two CNN modules. We call them CNN Scene Classification Module and CNN Scene Parsing Module (Figure 2). The Classification Module computes the initial raw top-5 predictions. The Scene Parsing module computes the scene contents from foreground and background. The Word Vector module computes the vector similarity between the contents present in the input image and the top-5 predicted labels. Using the computed similarity score, we output a refined re-ranked top-5 labels for the input image. We describe the details about each module in following subsections.

A. CNN Scene Classification Module
In this module, we train the ResNet models (one for each environment) on a reduced version of the Places365 dataset (based on our taxonomy, see table I). The code and model parameters can be downloaded from this link 4 . CNN Scene Classification Module computes the top-5 prediction labels which is further used by the Word Vectors Module to refine these prediction scores.

B. CNN Scene Parsing Module
In this module, we use a pre-trained CNN Scene Parsing model 5 . The CNN model was trained on ADE20K dataset [15]. It is trained to detect 150 different object categories from the given input image. The Scene Parsing module tells us the different objects/contents present in a given input image. For a kitchen input image, the parser would output the presence of kettle, stove, oven, glasses, plates, etc. We convert these object labels as English words and pass that onto Word Vectors module, described in the section below.

C. Word Vectors Module
Now we know the objects present in each of the images in the dataset. Knowing the top-5 predictions of each image and the objects present in each of the images, we need to make use of this information to refine the top-5 scores. 4 http://places2.csail.mit.edu/ 5 https://github.com/CSAILVision/sceneparsing This section is the main contribution of this work. First, we define some of the notations being used and then describe our approach using these notations.
Notations used: let V be the dictionary/vocabulary containing the objects, O and the scenes, S present in the dataset. RT k = W ordV ectorM odule (IO k , T k , ACC k ) 5. return RT IV ector k (j) = < 0 > vector 4. for oi ∈ IO k do 5.
Similarity[j] = cosine(IV ector k (J), sj) 7. Similarity = N ormalize(Similarity) 8. RT k = descendingOrder(ACC k * Similarity) 9. return RT k Now we have the initial top-5 predicted classes T k for each image, I k obtained from the Scene Classification module and the set of objects, IO k present in each image obtained from the scene parser module. Our approach can be summarized in Algorithm 1. To compute the refined top-5 scene classes predictions, RT k : first we compute a vector representation for the image with respect to each of the top-5 predicted classes. We compute a weighted vector sum of the detected objects in the image to represent the image vector. The vector representation for a given input image, I with respect to a scene s j is computed as follows: Here o i ∈ IO k . The weights, w i,j and vectors, o i are learned by the word vector module (see Figure 3). IV ector k (j) is the vector representation of the input image, I k in terms of the objects present w.r.t. to scene label j. Refer to line 4,5 in Algorithm 1, Procedure 2.
Learning the object and scene vectors, V , and the weight matrix, W : Vectors in V are initialized by the pre-trained word2vector 6 , and W are initialized by tf-idf 7 . When computing tf-idf, we considered each scene class is a document, and the objects in the image are the words. The object representing the scene has a higher weight and the object occurring less frequently in the scene would have a lower weight. We pre-compute the training predictions, T , ACC and objects in images, IO. We feed this information into our cosine similarity training model (see Figure 3) to learn the weights, W and Vocabualry, V . The loss function used in our model was a hinge loss with margin equal to 0.1.
There are some objects, o i ∈ O which might exist in most of the scenes. Such objects contribute less in determining the class of the scene. So a lesser weight should be assigned to such objects while computing the weighted sum representation of the image vector, IV ector k (j). On the other hand, if an object exists only in some particular scenes, we need to increase the weight of this object. This is intuitive, for instance: the chances of finding a "sofa" is more likely in a "living-room" scene than any other place. Now we describe the dataset we built to validate our approach and provide empirical results obtained on our dataset and the Places365 dataset.

IV. THE DATASET
One of the current widely used datasets for Scene Classification is the Places365 dataset [1]. This dataset is the latest and largest Scene Classification dataset with more than 1 million images. Places365 has 365 scene categories with 3000 to 5000 images per class. However in this dataset there are many confusing places that are practically the same but have been labelled distinctly. For example, the places {bedroom, dorm room}, {lecture room, classroom}, {pharmacy, drug-store}, etc. are some sets of places that are referring to the same but labelled differently. Moreover, after a close inspection of this dataset, it was found that many images in the dataset are incorrectly labelled. Due to these mentioned issues with the Places365 dataset, we decided to merge certain classes into one before training our models (see taxonomy file on the project page 8 ). Additionally since in our work, we are only concerned about indoor places, we remove all outdoor places in the Places365 dataset. After this pre-processing step of removal and merging of places, we get a total of 156 different scenes for 8 different environments. We train our model using this pre-processed dataset.
For testing our proposed approach, we built a dataset in the real world of 69 different places (see table I), which we arranged in a hierarchical manner with 2 levels. First level (environment-type) lists out the major areas like school, home, shopping mall, etc. Each of the categories in the first level has sub-class scenes associated with them. For e.g., a shopping mall would have a set of places like gift-shop, food-court, salon, drug-store, etc. A detailed list of places in our testing dataset can be found in table I and at our project page 8 . We have a total of 10,000 testing images in our dataset. Out of these approximately 1000 images were extracted from videos on youtube as some places were not easily available in the real world and others were captured from a GoPro camera.

V. EVALUATION
In our taxonomy, we described 8 different environment types (School, Shopping Mall, Home, Condo Buildings, Airport, Public Transit, Hospital, and Hotel) using 156 indoor scenes. In this work, we select 3 environments to evaluate our approach, which are School, Home, and Shopping Mall (see Table I).
In our experiments, we trained a ResNet model for each environment with the selected scenes. The performance is listed in Table II. As one would expect, the ResNet model performs well on the reduced Places365 validation set. The performance on our test set is even higher, since our dataset is labeled with fewer human errors. Furthermore, we used a GoPro camera with wide-angle view mode, so the images perfectly represent the scenes. Overall, our method is better than a CNN model (ResNet50) in terms of accuracy. Our results proved that the "image context (objects)" plays a vital role in Scene Classification. Although, the refinement on Shopping Mall scenes is not noticeable, this is because the CNN Scene Parsing model we used could not find objects that can distinguish the scenes well enough. For instance, the model could not detect shoes, watches, hats, etc., which are commonly found in shopping malls. Figure 4 discusses the results of some images in our dataset. Finally, we also demonstrate our approach by deploying our algorithm on a Pioneer3AT robot in a university environment. The robot was configured with a ZED camera from which monocular images were used by our algorithm. The robot was equipped with a Razer Blade laptop with a GTX 1060 GPU. The demo video of the deployment is available on our project web-page 8 .

VI. CONCLUSION
In this paper, we introduced a new method for Scene Classification using a taxonomy for different indoor environments. Using our approach, robots can recognize different indoor places with high confidence/accuracy. A hierarchical taxonomy of places allowed us to prune out many irrelevant classes, thereby reducing the complexity/training time of our approach. A word embedding based approach was implemented to refine the top-5 scores for the scenes. It was shown that context has the potential to improve the Scene Classification results to some extent. We additionally tested our approach with a real world dataset that we built to show the practical applicability of our approach. We also deployed our algorithm on a robot in a university environment. On our dataset we could get promising results for doing Scene Classification for robots.


Creating Transparency in Algorithmic Processes

In recent years, innovations such as self-driving cars and image recognition have brought attention to artificial intelligence (AI). Machine learning (ML) is an application of artificial intelligence, made up of algorithms that analyse data and make predictions. Machine learning is increasingly being used to make critical decisions about individuals, such as whether they should be granted parole or whether they are deserving of a bank loan. These new technologies are unregulated, and their processes are insufficiently transparent. Often the predictive algorithms at the core of these technologies are created by private companies and black-boxed, meaning their internal workings are neither subject to nor even open to external oversight. What is worse, even the engineers designing these algorithms do not fully understand how the processes work. As modern society becomes more compute-oriented and data-driven, with computers being used to make critical decisions affecting individuals, greater transparency in algorithmic processes is more important than ever. Any ethical and just society requires some degree of openness and access in its technologies. While it may not be possible to expect an explanation for the entirety of an algorithmic process, we can employ what I will call checkpoints to advance our understanding at various stages of the machine-learning process. Transparent checkpoints can afford policymakers, sociologists, philosophers, information scientists and other non-computer scientists the opportunity to critically evaluate algorithmic processes in the interest of ethical concerns such as fairness and neutrality. The goal of this article is to explain machine learning concepts in a way that will be useful to policymakers and other practitioners. I will give examples of ways biases can be embedded in, introduced into, and reinforced by the original data, and I will introduce six checkpoints wherein black-boxed algorithms can be made transparent, taking care to show how these checkpoints advance our understanding of ethical concerns in machine learning systems.

I. Introduction
In the digital world, algorithms are everywhere. They are sets of computer instructions that perform tasks, such as suggesting movies we should watch, keeping our money safe in the bank, and warning us of objects in our way as we drive a car in reverse. Developments in technology are often presented in a positive light-consider the emphasis on improved safety with self-driving cars and facial-recognition technologies-but algorithms, embedded in computational systems, are also used to make decisions concerning people's lives. We must therefore consider whether the decisions they make are fair or ethical. 1 Machine learning is a process commonly used to make predictions or to classify people into groups-classifications that have the potential to do harm when, for example, someone is undeservingly rejected for a loan or pays an undue amount for car insurance. Researchers and policymakers are beginning to question machine learning processes, specifically the ways results are obtained, but they have realised it can be difficult to understand how these sys-DOI: 10.21552/delphi/2019/1/5 tems work. Companies tend to black-box their tools, not wanting to share their algorithms, while emphasising intellectual property and patent-protection concerns as justifications for their lack of transparency. 2 Software engineers who create machine learning techniques may have little understanding of how their algorithms reach certain decisions, making checkpoints an appealing option for exploring the inner workings of machine learning processes and the relationships between those processes and the outcomes they produce.
While the deepest inner-workings of algorithms might be difficult for most to comprehend, we are certainly capable of evaluating machine-learning processes as a whole and in the interests of fairness and neutrality. I will not define ethical terms such as fairness and bias in specific ways; rather, I will present a primer for policymakers, social scientists, and ethicists to better understand the machine learning process. I will identify checkpoints, describe what happens at each stage, and provide a bevy of solutions to promote transparency. The citations in the paper are a mix of scholarly and popular articles, and books, mainly intended for non-domain experts. I have attempted to use the latest sources, highlighting groups and researchers looking at these issues, although the literature cited skews to work done within and regarding the United States.
The technical complexity of these tools and systems creates a barrier to understanding their effects on society. We are told that results such as credit ratings are 'accurate,' but we are not told why-or how. Computer scientists are generally not trained in ethical concerns, such as promoting fairness and avoiding bias, and software engineers tend to have little experience in ethical realms. 3 Using algorithms to solve human problems is not new; what is new is the ever-growing datasets and diminished oversight of algorithms that predict human outcomes. Over time, the switch to data-intensive analysis and more complicated approaches to computational problem-solving have engendered a situation where algorithm de-signers do not fully understand how their own creations work. Older, simpler models were easier to understand; newer algorithms for artificial intelligence are, by contrast, incredibly complex and driven by massive amounts of data.
Against this backdrop, Section II explains machine learning processes for an audience of policymakers, social scientists, philosophers, and others with related interests. Following this, Section III proposes checkpoints as a way of promoting transparency and countering the phenomenon of black-boxing. Section IV offers descriptions of six checkpoints that can be made transparent in machine learning processes, checkpoints that can be used when transparency requires human intervention. Ultimately, I argue that creating transparency to understand how these algorithms make decisions is not necessarily incompatible with black-boxing, as checkpoints can clarify processes without exposing trade secrets. In doing so, I will give examples of how transparency can be invoked and instituted in a variety of means to allow the public ways to examine algorithmic systems and, hopefully, lead to the betterment of society.

II. What is Machine Learning?
Machine learning is not new: the term was coined by Arthur Samuel in 1959, and over the years it has slowly evolved to the complex processes used today. Machine learning processes are made up of algorithms, which are themselves made up of code and data. Algorithms are sets of instructions performing tasks in the computer, but these instructions are not explicit; rather, the computer 'learns' from analysing data with known attributes (supervised machine learning) and then makes predictions of similar data.
In the interest of simplicity, I use the term algorithm to mean both its conceptual sense and with regard to its implementation. Thus, referring to an algorithm as 'potentially problematic' can mean its execution has produced a result that is ethically troublesome.
In this paper, I will focus on machine learning, as opposed to artificial intelligence, because machine learning methods are commonly used to predict outcomes for individuals, while also designating individuals into categories, which is particularly prob- lematic. While facial-recognition programs and other deep learning models are also ethically fraught, I will focus on predictive machine learning of human activity, while conceding that these terms can occasionally be blurred (ie, certain ideas can be considered both ML and AI).
In explaining further how ML works, I introduce a thought experiment. Consider the hypothetical Friendly Car Insurance Company (hereafter: Friendly Insurance). When determining the cost of a plan, insurance companies generally look at the type and amount of coverage desired, as well as personal information about the applicant. Assume Friendly Insurance uses machine learning techniques to evaluate a driver's risk potential and to predict appropriate insurance premiums (ie, the cost of a policy). Assume that scientists at Friendly Insurance use a variety of datasets including personal information, while also employing two types of algorithms: some based on open-source software libraries and some that are proprietary entities beyond public access or understanding.
The personal information dataset contains hundreds of thousands of records of individuals that could be past or present customers. The dataset contains attributes, also called data features, input features, or variables, describing each individual. 4 , 5 Each record lists dozens of features about the individual seeking coverage, such as gender, age, and home address. In practice, a data scientist will often choose features to include in or discard from an analysis-thus the 'art' of data science in this regard.
At this point in the process, the data scientist understands what questions she wants the data to answer, and she is ready to assess how much a potential new customer will need to pay for car insurance. This price is called the target variable, target, or outcome.
The data scientist then takes a random portion of the dataset, perhaps seventy percent of the records, and names this the training set, before putting the remaining thirty percent into a test set. The data scientist then sends the training set (containing all features and output prices) through the machine learning algorithm so it can analyse the features and detect relationships between those features and their corresponding prices. This is the 'learning' part of the computation.
During this analysis, the algorithm discovers from the past examples which features affect premiums, noting how much they negatively or positively affect price. Age, for example, will affect the cost of insurance if the applicant is young. Features are assigned weights, depending on how much they factor into prices, and thus if the algorithm finds that prior accidents greatly affects the price, that factor will be weighted more than another feature, such as the color of the applicant's car. The result of this training is a matrix of weights of the features.
At this point, the scientist runs the now-trained algorithm on the test set, and the computer predicts what the premium price should be, based on what it learned from the training set. An accuracy percentage for the algorithm's predictions is displayed, and the accuracy is known because the real premium prices are exposed to the computer and the costs are compared. At this point, data scientists will often run multiple algorithms in search of the best accuracy rate. Once the data scientist is satisfied with the algorithm's efficacy, she can proceed 'into the wild' and attempt to predict premium prices for potential customers.

III. Checkpoints for Transparency
To demonstrate its efficacy as a tool for prediction, I have purposefully chosen a simple example of how machine learning works. The origins of machine learning stem from statistical-based tasks, creating models for prediction.
An increasing number of these tools are being used to decide outcomes based on people, issues which might seem harmless, such as how much an insurance company can charge for coverage. Yet, problems arise in the use of predictive tools. For example, the black-boxing of an algorithm used to assess the likelihood of recidivism, in other words to determine who deserves parole, raises serious concerns about the fairness of techniques deployed within the criminal justice system. In a similarly discon-certing way, when consumers are charged more for auto insurance in poorer neighbourhoods, and when the reasons for their higher premiums are beyond (or denied) explanation, bias becomes normalised. 6 The common trope that machine learning is alchemy that 'just works' does not hold up when citizens demand answers. 7 We must then discover how transparency can enable us to further understand these systems.
The solution I propose below is a series of six checkpoints that will expose the inner workings of the machine learning system. Machine-learning techniques are numerous and complex. Some examples include convolutional neural networks (CNNs), adversarial neural networks (ANNs), decision trees, and clustering techniques. Some processes use a multitude of techniques in iterative ways, leading to complicated paths of calculations as the data wend their way through the system. That said, there are ways data scientists can delineate tasks to be performed that can be documented, explained, and understood by the general public. I call these delineations checkpoints to enable transparency. At each checkpoint, various methods are suggested, including activities conducted by both internal and external audits. Ultimately, dividing up the tasks at breakpoints may reveal problems as well as options for addressing them in a targeted manner. Remedies may take the form of reports, metadata, training, governance, and public involvement, among other possibilities. Our task here is daunting, as so few regulations exist, but I will begin with the most important of all, data collection.

Data Collection a. Data, Data, Everywhere
All machine learning starts with data. These data may have been obtained from public records, surveys, private data-collection firms, or a combination of sources, and information may have been scraped, munged, simulated, or modelled. Contrary to popular belief, preliminary data are not 'raw'-not mere bits of information obtained objectively; to the contrary, data have been generated through cultural and societal lenses that profoundly and often invisibly shape their nascent existence. 8

b. Bias in the Data
Since machine learning draws from statistics, computer science, and mathematics, the vernacular used to describe aspects of datasets can often vary. Bias, for example, means different things to a statistician and a social scientist.
One of the first problems in examining a dataset is determining its provenance: where, how, and by whom it was created. A major factor leading to biased results in machine learning is that the original dataset is skewed in some way, because machine learning reifies the original data's characteristics and applies them to new data. 9 Since much data is labeled by hand, skewed data can result from many different situations, such as ways that cause certain groups to face bias. 10 Following AI Now Institute's lead, the word bias will mean the following for the purposes of this paper: 'Judgement based on preconceived notions or prejudices', 11 with the understanding that bias is also a statistical term with a much more generic meaning. Thus, readers should be cautious with meanings of terms when reading texts concerning machine learning.
Another example of biased datasets is historical data gathered as a result of known, biased police practices. 12 Machine learning techniques will only reify the information they are fed; this is the 'garbage in, garbage out' data conundrum. Scholars Barocas and Selbst 13 look specifically at problems that can emerge in data-mining processes, using framing based on American antidiscrimination law. Tools to scrape data from the web are used to gather massive stores of information. These methods of obtaining data might be violations of terms-of-service agreements or laws, but once data are collected, they are easy to copy and transmit, creating confusion of ownership along legal lines. 14 It is often the case that certain data have been made available online, although they were never intended to be scraped, collected, or combined with other online data to create new datasets.
Returning to Friendly Insurance, we know what kinds of data customers provide to obtain coverage, such as their name, driver's license number, address, and age. But what other information is collected about the individual? In the United States, the external data that can be collected on individuals varies by state. Some states allow credit scores, occupation, and other data to be used to determine premiums, but in reality, all manner of data could be collected, such as shopping habits, criminal records, Facebook posts, and so on. 15 Insurance companies compete to create accurate models of risk so they can attain competitive prices, allowing them to acquire new data in creative ways. But what does all this mean for the consumer?
Another concern in primary data collection is that the data may already be biased, allowing for disparities that will be reified in predictions. For example, as cited earlier, studies have shown car insurance companies in the United States charge higher rates in minority neighbourhoods. 16 Let's assume Friendly Insurance takes the same approach. This means that, later in the machine learning process, the computer will 'learn' that certain neighbourhoods get charged more for premiums, thereby continuing an unjust practice until it is 'told' otherwise.

c. Addressing the Data Collection Checkpoint
Bringing social science methodologies into a computational space can provide a different context and way of understanding bias in datasets. One approach is to hire people outside of computer science and engineering to develop standards and to audit datasets. 17 Metadata, for example, can be attached to datasets-think of them as 'datasheets for datasets' 18 -to encourage transparency and accountability by supplying characteristics of the dataset in a standardised way. This approach resembles that of computer hardware, which is required to have detailed information accompanying each component, information that explains its purpose and recommended usage. Examples of items in the datasheet could be data-collection methods, provenance, maintenance, updates and additions to the dataset, privacy conditions, and legal information. 19 Another proposed solution is the Dataset Nutrition Label, a framework that provides a list of dataset 'ingredients', paralleling the approach of food nutrition labels. 20 Later, when end-results of algorithms are evaluated, this step is crucial in comparing a dataset's intended purpose with its final results. This step is also essential to efforts to root out prejudice that should not have influenced evaluations in the first place.

Data-Cleaning Stage a. What is Data Cleaning?
The data-cleaning stage is the 'in house' data-manipulation stage. In stage one of data collection, the data scientist running the machine algorithms is assumed not to have collected the data, but rather to have simply obtained it from other sources. The data-cleaning stage is where the data scientist studies the dataset(s) to be used, examines them if they need to be altered, and determines what parts of the dataset will be used. For example, some columns might need to be re-labelled or datasets with different labels for the same concepts will need to be streamlined. Data points with little or no data might Creating Transparency in Algorithmic Processes be removed, and outliers must be addressed. At this step the training sets and test sets are created.

b. Problems in Data Preparation
Choosing what gets included in the data set for analysis is a highly subjective task. The inclusion or deletions of specific features can thus inject certain norms and views into a dataset, norms and views that could introduce or reaffirm biases. Builders of machine learning systems are predominantly white males from Western societies, and they can often fail to realise how their choices might be unfair to certain groups. As a category, race is problematic. But simply removing race from consideration is, at the same time, rarely sufficient for avoiding racial bias, because race is highly correlated with other categories, such as zip (postal) codes. To this end, the data scientist may potentially impose her bias into the dataset, either consciously or subconsciously. In the case of Friendly Insurance, at this point the data scientist will decide which features to use in the training and test sets. The data scientist's aim is to minimize the company's exposure while finding the right price point for any given consumer. These choices, along with regulations at the state level, shape the model used for pricing decisions, reflecting the broader manner by which outputs are a function of inputs.

c. Solutions to Make Data Preparation Transparent
This checkpoint, like the previous one, involves preparing data for analysis. A report from the data scientist would be combined with metadata gathered about the dataset during the collection phase, perhaps in the form of the above described datasheet. The goals of the analysis are the most important in-formation to document at this point, along with justifications and explanations for the cleaning, ensuring that expressed interests are consistent with the overall process of evaluation. Creating a more robust paper trail that archives the intent of the analysis while also explaining why decisions were made to curate the data in a certain way can help determine if the algorithm is meeting its objectives.

Algorithm Choice a. Choosing an Algorithm
The data scientist may use a number of machine learning methods to analyse data. A particular algorithm might be employed; or, more commonly, a plethora of algorithms might be chosen, with those yielding the best results adopted and deployed. 21 At this juncture, it may be difficult to choose those algorithms likely to yield the best results. I concede the risk in conflating algorithms and the technologies built with algorithms, but given the current climate of little to no oversight over algorithmic processes, any effort to make these systems and structures more transparent is a move in the right direction. Our social systems are fraught with insufficiently understood and woefully undertested machine-learning systems, so accepting the need for reform is a critical first step. 22

b. Issues with Choosing Algorithms
In the past, easily understood mathematical models were (and are still) used to determine decisions about people's lives. However, more complex machine learning approaches are increasingly being used to automate these processes, meaning that computers themselves have learned how to make decisions in little-understood ways. Current tools lack functionality to provide feedback to explain their decision-making properties, creating clouds of uncertainty around the tools, no matter how intelligent the devices might seem to be. 23 Because the tools lack ways to explain why and how they make particular decisions, evaluating an algorithm for fairness is difficult. Fairness can mean different things to different people, both ethically and mathematically. A recent study has shown that an ideal form of fairness may be impossible, due to mutually exclusive mathematical properties. 24  researchers have identified the problem that prior work on algorithmic fairness looks at conditions for unfairness; but little work has been done to establish measures for fairness. 25 A canonical example of a discrepancy over the definition of fairness between researchers and a software company is the COMPAS risk-assessment tool that was designed to predict rates of recidivism-that is, the likelihood that convicted criminals will reoffend. 26 When researchers evaluating COMPAS disagreed with the company's results, it became clear that the parties were relying on different definitions of fairness in their evaluation of the program. The company claimed fairness on the basis that the scores meant the same thing regardless of the offender's race. On the other hand, the researchers noted that for people who did not reoffend, blacks were twice as likely as whites to be classified as high or medium risk. In this case, the company did not want to explain how its algorithms were coming up with results, so there was no way to examine the algorithm's behavior for why it made the choices that it did. The company relied on end results only to prove its point.

c. Solutions at this Checkpoint
A better understanding of machine-learning algorithms and how they work will benefit society at large. If, for the sake of argument, we assume the original dataset is ethically appropriate and prepared for use, it would be possible to evaluate the algorithm's choices. At this checkpoint, understanding how the algorithm makes decisions can inform data scientists in their algorithm implementations. Also, comparisons of how different algorithms perform and produce results would be useful in decision-making processes. Mathematical fairness versus human interpretations of fairness (as it pertains to ethical questions) is a tension at this checkpoint. 27 Statistical methods for assessing fairness should be coupled with sociological efforts at defining acceptable parameters for determining fairness. Thus, at this juncture in the machine-learning process, we must recognise and evaluate those mathematical elements that purport to calculate fairness, with special attention to differing definitions of fairness. The parts of algorithms that deal with these notions should be made available for evaluation.
Some approaches involve developing algorithms resistant to human biases in the data; others involve ways of designing algorithms that have demonstrable ways to elucidate algorithms' behaviors in a clear and straightforward manner. A radical, although plausible, solution is to train algorithms themselves to detect unfair decisions and to then remedy the problems detected. 28 However, there is always a danger in asking an algorithm to fix its own troubles.

System Design a. What is System Design?
After the algorithms have been selected, the designer runs the algorithms on the training and test sets, resulting a model to be tweaked and improved upon. For example, a data scientist can adjust weights to certain features to make them more (or less) important within the algorithmic process. 29 Feature selection is a process where the data scientist decides which features will be prioritised in the algorithm. 30 Another way of stating this is that predictor variables are used to assess the value of the target variable. For example, a target variable could be a credit score. Features are inputs, whereas labels, also known as class labels, are system outputs.

b. System Design Can Be Problematic
The combination of human handiwork and machinelearning algorithms can result in a highly complex system that is little understood. Additionally, a number of developers may be involved in adjusting the code along the way, further muddying the waters. Because parameters can be tweaked at any point, dis- criminatory results are sometimes only discovered after the processes have been run. 31 The system's opacity is likely greatest at the design stage, because this is when a company's trade secrets are implicated. Opacity can take several forms, such as deliberately concealed inner workings, systems rendered opaque because only technical experts can understand them, and abstruseness due to differences in perception between humans and computers. 32 For Friendly Insurance this is the point where the data scientist would tweak the model to improve its accuracy. For example, she might find that credit score is a very strong predictor of price point and therefore weight the score more strongly in the model. Insurance is a competitive business, and the company's data scientist does not want to share these ideas with competitors. At this checkpoint the tweaked model is a highly valued trade secret.

d. Proposed Solutions at Checkpoint System Design Stage
Previous work suggests that the form opacity takes determines the technical and non-technical solutions that could help, and thus a first step is to identify types of opacity occurring at this stage. 33 Corporate secrecy concerns certainly require something more than merely not understanding the technology. At this stage of system design, some scholars suggest the use of auditors to examine the code (which would require them being able to access it) to ensure nondiscriminatory practices. 34 Considerations should be made if the algorithm works well with certain groups of people but not others, such as marginalised populations, for example, which is a common complaint in the AI sphere. Other work highlights the need to design algorithms that align with the creator's needs, along with ways of designing systems that flag problems and alert creators to potential issues.

Results of Algorithm a. Algorithm Results Description
In machine learning, training sets are fed first through the algorithm and then through test sets to evaluate the models. At this checkpoint stage, before the algorithm is released, its results are examined. This stage assumes that the data scientist is satisfied with the features, weights, and algorithmic choices, and is now evaluating results. Thus, this is the first stage for looking at outputs in a concrete way. When using test sets, it is possible to obtain error rates on categorical methods. These error rates are calculated by the proportion of cases where the prediction is incorrect. There are many ways to define error in machine learning. I will demonstrate one example from a classification model, where there are four outcomes and where the condition is defaulting on loan. A true positive is a result that finds that the predicted condition of the algorithm is true, meaning the person was predicted to have defaulted on a loan and did so. A false positive (Type 1 error) occurs when the predicted condition did not happen, meaning the person was predicted to default but did not. A false negative (Type II error) is when the condition is not predicted to happen but did, such as when a person is expected to default on a loan but does not. A true negative, the fourth possible outcome, is when the condition was not predicted to happen, and did not happen, meaning, in our context, that a person was not predicted to default and ultimately did not.

b. Problems at the Results Checkpoint?
False positive results can have disastrous effects on people. Those individuals who find themselves cast in this light lack a sense of agency in these circumstances; they may not realise they've been categorised as such and, even if they do discover this information, they often lack the power to do anything about it. 35 While credit scores in the United States, for example, are regulated and accessible to consumers, other types of scoring carried out-by companies amassing and combining data from web browsing, purchasing patterns, and other sources of public information about individuals-are often used to categorise people in dubious ways. 36 Because Friendly Insurance is a corporation, the profit motive steers the company to find any advantage it can, using any data it can gather to present the most favorable bottom line to shareholders. Data scientists at Friendly Insurance will almost certainly rely on credit scores generated by third parties, but these scientists generally won't know whether the scores were determined fairly. They incorporated the information but they didn't have a hand in creating it-which is the entire problem in a nutshell. Information is essential-and pervasive-and interested parties will take advantage of the data they need to advance their operations without contemplating the potential injustices built into the system.
As philosophers Mittelstadt et al 37 write, 'algorithmic processing contrasts with traditional decisionmaking, where human decision-makers can in principle articulate their rationale when queried, limited only by their desire and capacity to give an explanation, and the questioner's capacity to understand it. The rationale of an algorithm can in contrast be incomprehensible to humans, rendering the legitimacy of decisions difficult to challenge.' Faced with these difficult tasks, auditors of systems are wise to individuate the myriad steps and to evaluate pieces the best they can.

c. Solutions
To improve current systems, we require a deeper understanding of what can go wrong in algorithmic processes. Some problems are caused by design mistakes, some by processes gone awry. Some errors, such as false positive classifications, can even be considered a normal part of a machine learning process. Algorithmic systems can be designed to alert humans to processes that appear to be malfunctioning or toward methods for evaluating problematic false positives in results. Oftentimes an algorithm is merely repeating the patterns it finds in the data-which might be inherently biased against certain groups of people-rather than making 'mistakes.' Machine learning system designers must take great care not to employ systems that simply mirror unjust situations.
One solution is to assign responsibility for certain pieces of the system. In this way, designers would be forced to think more deeply about potential outcomes. Institutions can mitigate risk by justifying methodologies and by preserving testing histories for algorithms. Some scholars even argue that public audits of these systems are necessary and should include not only statistical explanations but also related human factors for the safeguarding of privacy rights. 38 Along with this, individuals subjected to the algorithms should be able to inspect their own data, with possibilities for changing this data. Scores, for example, are a singular output when names and other identifying information are entered into an evaluation tool. Legislation is one way to allow individuals to inspect the data associated with them during these processes.
By their very nature, machine learning algorithms evolve and change. It is difficult to determine which versions of code and data to use in making decisions. Creating transparency may seem to be equivalent to instituting more open documentation, but it actually goes beyond that: greater efforts toward transparency will yield greater attention to and an eventual realisation of fairness. If we find otherwise-if transparency indicates that fairness is not possible within the present system of algorithms and the designers creating them-then a more thorough, all-inclusive solution may be required.
Scholarly researchers are looking at new ways to investigate operations of black-boxed algorithms. One line of inquiry deals with indirect influence: that is, removing features from the dataset and examining subsequent accuracy rates. In this way, a feature's influence can be quantified. 3940 These methods involve statistical frameworks that better handle relationships between features and the target. A deeper understanding of relationships between features enables designers to address issues of bias based on feature selection.
Creating Transparency in Algorithmic Processes

End: Evaluation Checkpoint a. The Evaluation Checkpoint
At the evaluation checkpoint, the machine learning system is operational and has been 'released into the wild.' The system might be in the form of packaged software or a set of black-boxed tools, and it might be employed at a private company, such as an insurance outfit, or in a public institution, perhaps for police or governmental use. Some tools might be built in-house or marketed and sold to others. In the case of Friendly Insurance, potential customers submit their personal information online and then receive a price quote, a quote that is generated through a machine-learning process.

b. Problems at Evaluation
The deployment of a system called Centrelink in Australia's Department of Human Services, which delivers social security payments, illustrates the dilemma of automation. 41 Disbursement was originally done by hand, with people handling the billing services and customer help, but then operations became automated and disaster ensued. Algorithms were riddled with errors, and people were sent bills for debts they didn't actually owe. Adding to the problem, the officers who previously handled customer service were told to steer clients to the computer interface of the system if they desired to challenge these mistakes. Eventually, complaints mounted and the situation became political, with activist groups getting involved and journalists reporting on the events. Researchers can learn from this fiasco by examining how the public interacts with systems, and data collected before and after automating a system can provide insight on these effects. Replication of results, if possible, is an important consideration at this checkpoint. If the data used in the process is publicly available, other groups may attempt to obtain the same results, thus yielding improved transparency. But, of course, negotiating these black-boxed tools makes the practice of replicating results difficult.
Understanding the machine-learning tool's potential effects on society is critical at this checkpoint. For example, what are the objectives of the tool maker? Has the maker tested for bias? 42 As more of these tools come into use in society, we must trace and analyse their effects. Sets of metrics can be developed to classify them and evaluate how they are deployed in society. Another consideration is monitoring the effects of systems throughout different communities, as bias most often occurs in the data of marginalised communities. Another important point is to track what types of people built and/or will maintain the tool. Is there a diverse representation of people?

c. Proposed Solutions at Evaluation Checkpoint
One solution that has been proposed to engage the ethically fraught environment of machine learning is the creation of people's councils. In the words of McQuillian, 'Setting up [such councils] means countering lack of consent with democratic consensus, replacing opacity with openness and reintroducing the discourse that defines due process.' 43 In the context of ethical machine learning, these councils could take the form of other types of councils in health and civil rights organisations. Similar solutions, such as those observed by scholar Crooks, encourage a townhall-meeting approach to explore technological and ethical concerns by bringing together users, maintainers, and the community to examine the use of technology as a group endeavor. 44

V. Conclusions
Machine learning systems have increasingly been adopted in a multitude of ways. Technological advancements in ML and AI have thus far outpaced regulatory activities, raising ethical concerns as tools become more widely entrenched in society. There is, however, a growing body of literature calling for ML makers to purposively design systems with potential pitfalls in mind, 45 and also for ML designers to ac- knowledge differences between benign uses of ML, such as video recommenders, and potentially pernicious uses, such as in the case of bank loans, police surveillance, healthcare, or parole. 46 The fields of computer science, engineering, and other technical domains are slowly incorporating ethical considerations into design and education realms. Researchers are also attempting to understand precisely how these algorithms work. 47 As evidenced by the footnotes, more people and organisations are recognising that the lack of transparency in machinelearning systems is a serious problem. One major change to data rights has been the rolling out of GDPR, although it remains to be seen what the law's effects will be. Still, it shows steps in the right direction.
The biggest challenge in making machine-learning systems more transparent is the extreme complexity and technological know-how involved. Deconstructing these processes and creating checkpoints is one way to promote greater understanding of black-boxed systems. Collaborations between pol-icy makers, legal scholars, social scientists, and technology experts may encourage more fairness and accountability within machine learning systems.
The general public should also contribute to this effort, sharing their own experiences with these systems. One set of checkpoints alone will not alleviate the problems caused by black-boxed systems; but a combination of solutions, both social and technical, will pave the way for improvements in these systems. Promising work includes standardised solutions, such as datasheets, regulatory changes, and a general shift in thinking toward prioritising understanding of the effects on society in our increasingly algorithmic world.


Dual Adversarial Neural Transfer for Low-Resource Named Entity Recognition

We propose a new neural transfer method termed Dual Adversarial Transfer Network (DATNet) for addressing low-resource Named Entity Recognition (NER). Specifically, two variants of DATNet, i.e., DATNet-F and DATNet-P, are investigated to explore effective feature fusion between high and low resource. To address the noisy and imbalanced training data, we propose a novel Generalized Resource-Adversarial Discriminator (GRAD). Additionally, adversarial training is adopted to boost model generalization. In experiments, we examine the effects of different components in DATNet across domains and languages and show that significant improvement can be obtained especially for low-resource data, without augmenting any additional hand-crafted features and pre-trained language model.

Introduction
Named entity recognition (NER) is an important step in most natural language processing (NLP) applications. It detects not only the type of named entity, but also the entity boundaries, which requires deep understanding of the contextual semantics to disambiguate the different entity types of same tokens. To tackle this challenging problem, most early studies were based on handcrafted rules, which suffered from limited performance in practice. Current methods are devoted to developing learning based algorithms, especially neural network based methods, and have been advancing the state-of-the-art progressively (Collobert et al., 2011;Lample et al., 2016;Chiu and Nichols, 2016;Ma and Hovy, 2016). These end-to-end models generalize well on new entities based on features automatically learned from the data. However, when † The first two authors contributed equally. ‡ Corresponding author.
the annotated corpora is small, especially in the low resource scenario (Zhang et al., 2016), the performance of these methods degrades significantly since the hidden feature representations cannot be learned adequately.
Recently, more and more approaches have been proposed to address low-resource NER. Early works (Chen et al., 2010;Li et al., 2012) primarily assumed a large parallel corpus and focused on exploiting them to project information from high-to low-resource. Unfortunately, such a large parallel corpus may not be available for many low-resource languages. More recently, crossresource word embedding (Fang and Cohn, 2017;Adams et al., 2017;Yang et al., 2017) was proposed to bridge the low-and high-resources and enable knowledge transfer. Although the aforementioned transfer-based methods show promising performance in low-resource NER, there are two issues remain further study: 1) Representation Difference -they did not consider the representation difference across resources and enforced the feature representation to be shared across languages/domains; 2) Resource Data Imbalancethe training size of high-resource is usually much larger than that of low-resource. The existing methods neglect such difference in their models, resulting in poor generalization.
In this work, we present a general neural transfer framework termed Dual Adversarial Transfer Network (DATNet) to address the above issues in a unified framework for low-resource NER. Specifically, to handle the representation difference, we first investigate on two architectures of hidden layers (Bi-LSTM) for transfer. The first one is that all the units in hidden layers are common units shared across languages/domains. Another is composed of both private and common units, where the private part preserves the independent language/domain information. Extensive experiments are conducted to show that there is not always a winner and two transfer strategies have their own advantages over each other in different situations, which is largely ignored by existing research. On top of common units, the adversarial discriminator (AD) loss is introduced to encourage the resource-agnostic representation so that the knowledge from high resource can be more compatible with low resource. To handle the resource data imbalance issue, we further propose a variant of the AD loss, termed Generalized Resource-Adversarial Discriminator (GRAD), to impose the resource weight during training so that low-resource and hard samples can be paid more attention to. In addition, we create adversarial samples to conduct the Adversarial Training (AT), further improving the generalization and alleviating over-fitting problem. We unify two kinds of adversarial learning, i.e., GRAD and AT, into one transfer learning model, termed Dual Adversarial Transfer Network (DATNet), to achieve end-toend training and obtain significant improvements on a series of NER tasks In contrast with prior methods, we do not use additional hand-crafted features and do not use cross-lingual word embeddings as well as pre-trained language models (Peters et al., 2018;Radford, 2018;Akbik et al., 2018;Devlin et al., 2018) when addressing the crosslanguage tasks.

Related Work
Named Entity Recognition NER is typically framed as a sequence labeling task which aims at automatic detection of named entities (e.g., person, organization, location and etc.) from free text (Marrero et al., 2013). The early works applied CRF, SVM, and perception models with handcrafted features (Ratinov and Roth, 2009;Passos et al., 2014;Luo et al., 2015). With the advent of deep learning, research focus has been shifting towards deep neural networks (DNN), which requires little feature engineering and domain knowledge (Lample et al., 2016;Zukov Gregoric et al., 2018;Zhou et al., 2019). (Collobert et al., 2011) proposed a feed-forward neural network with a fixed sized window for each word, which failed in considering useful relations between long-distance words. To overcome this limitation, (Chiu and Nichols, 2016) presented a bidirectional LSTM-CNNs architecture that automatically detects word-and character-level features. Ma and Hovy (2016) further extended it into bidirectional LSTM-CNNs-CRF architecture, where the CRF module was added to optimize the output label sequence.  proposed task-aware neural language model termed LM-LSTM-CRF, where character-aware neural language models were incorporated to extract character-level embedding under a multi-task framework.
Transfer Learning for NER Transfer learning can be a powerful tool to low resource NER tasks. To bridge high and low resource, transfer learning methods for NER can be divided into two types: the parallel corpora based and the shared representation based transfer. Early works mainly focused on exploiting parallel corpora to project information between the high-and low-resource languages (Yarowsky et al., 2001;Chen et al., 2010;Li et al., 2012;Feng et al., 2018). For example, (Chen et al., 2010) and (Feng et al., 2018) proposed to jointly identify and align bilingual named entities. Ni et al. (Ni and Florian, 2016;Ni et al., 2017) utilized the Wikipedia entity type mappings to improve low-resource NER. (Mayhew et al., 2017) created a cross-language NER system, which works well for very minimal resources by translate annotated data of high-resource into lowresource. On the other hand, the shared representation methods do not require the parallel correspondence (Rei and Søgaard, 2018). For instance, (Fang and Cohn, 2017) proposed cross-lingual word embeddings to transfer knowledge across resources. (Yang et al., 2017) presented a transfer learning approach based on deep hierarchical recurrent neural network, where full/partial hidden features between source and target tasks are shared. (Al-Rfou' et al., 2015) built massive multilingual annotators with minimal human expertise by using language agnostic techniques. (Cotterell and Duh, 2017) proposed character-level neural CRFs to jointly train and predict low-and highresource languages. (Pan et al., 2017) proposes a large-scale cross-lingual named entity dataset which contains 282 languages for evaluation. In addition, multi-task learning (Yang et al., 2016;Luong et al., 2016;Rei, 2017;Aguilar et al., 2017;Hashimoto et al., 2017;Lin et al., 2018) shows that jointly training on multiple tasks/languages helps improve performance. Different from transfer learning methods, multi-task learning aims at improving the performance of all the resources instead of low resource only.

Adversarial Learning
Adversarial learning originates from Generative Adversarial Nets (GAN) (Goodfellow et al., 2014), which shows impressing results in computer vision. Recently, many papers have tried to apply adversarial learning to NLP tasks. (Liu et al., 2017) presented an adversarial multi-task learning framework for text classification. (Gui et al., 2017) applied the adversarial discriminator to POS tagging for Twitter. (Kim et al., 2017) proposed a language discriminator to enable language-adversarial training for cross-language POS tagging. Apart from adversarial discriminator, adversarial training is another concept originally introduced by (Szegedy et al., 2014;Goodfellow et al., 2015) to improve the robustness of image classification model by injecting malicious perturbations into input images. Recently, (Miyato et al., 2017) proposed a semisupervised text classification method by applying adversarial training, where for the first time adversarial perturbations were added onto word embeddings. (Yasunaga et al., 2018) applied adversarial training to POS tagging. Different from all these adversarial learning methods, our method is more general and integrates both the adversarial discriminator and adversarial training in an unified framework to enable end-to-end training.

Dual Adversarial Transfer Network
In this section, we introduce two transfer architectures for DATNet in detail. For the base model, we follow the state-of-the-art LSTM-CNN-CRF based structure Lample et al., 2016;Chiu and Nichols, 2016;Ma and Hovy, 2016) for NER task, as shown in Figure 1(a).

Character-level Encoder
Previous works have shown that character features can boost sequence labeling performance by capturing morphological and semantic information (Lin et al., 2018). For low-resource dataset to obtain high-quality word features, character features learned from other language/domain may provide crucial information for labeling, especially for rare and out-of-vocabulary words. Characterlevel encoder usually contains BiLSTM (Lample et al., 2016) and CNN (Chiu and Nichols, 2016;Ma and Hovy, 2016) approaches. In practice, (Reimers and Gurevych, 2017) observed that the difference between the two approaches is statistically insignificant in sequence labeling tasks, but character-level CNN is more efficient and has less parameters. Thus, we use character-level CNN and share character features between high-and low-resource tasks to enhance the representations of low-resource.

Word-level Encoder
To learn a better word-level representation, we concatenate the character-level features of each word with a latent word embedding as where the latent word embedding w emb i is initialized with pre-trained embeddings and fixed during training. One unique characteristic of NER is that the historical and future input for a given time step could be useful for label inference. To exploit such a characteristic, we use bidirectional LSTM architecture (Hochreiter and Schmidhuber, 1997) to extract contextualized word-level features. In this way, we can gather the information from the past and future for a particular time frame t as follows, After the LSTM layer, the representation of a word is obtained by concatenating its left and right context representation as follows, To consider the resource representation difference on word-level features, we introduce two kinds of transferable word-level encoder in our model, namely DATNet-Full Share (DATNet-F) and DATNet-Part Share (DATNet-P). In DATNet-F, all the BiLSTM units are shared by both resources while word embeddings for different resources are disparate. The illustrative figure is depicted in the Figure 1(c). Different from the DATNet-F, the DATNet-P decomposes the BiL-STM units into the shared component and the resource-related one, which is shown in the Figure 1(b). Different from existing works (Yang et al., 2017;Fang and Cohn, 2017;Cotterell and Duh, 2017;Cao et al., 2018), in this work, we investigate the performance of two different shared representation architectures on different tasks and give the corresponding guidance (see Section 4.5).

Generalized Resource-Adversarial Discriminator
In order to make the feature representation extracted from the source domain more compatible with those from the target domain, we encourage the outputs of the shared BiLSTM part to be resource-agnostic by constructing a resourceadversarial discriminator, which is inspired by the Language-Adversarial Discriminator proposed by (Kim et al., 2017). Unfortunately, previous works did not consider the imbalance of training size for two resources. Specifically, the target domain consists of very limited labeled training data, e.g., 10 sentences. In contrast, labeled training data in the source domain are much richer, e.g., 10k sentences. If such imbalance was not considered during training, the stochastic gradient descent (SGD) optimization would make the model more biased to high resource (Lin et al., 2017b).
To address this imbalance problem, we impose a weight α on two resources to balance their influences. However, in the experiment we also observe that the easily classified samples from high resource comprise the majority of the loss and dominate the gradient. To overcome this issue, we further propose Generalized Resource-Adversarial Discriminator (GRAD) to enable adaptive weights for each sample which focuses the model training on hard samples. To compute the loss of GRAD, the output sequence of the shared BiLSTM is firstly encoded into a single vector via a self-attention module (Bahdanau et al., 2015), and then projected into a scalar r via a linear transformation. The loss function of the resource classifier is formulated as: where I i∈D S , I i∈D T are the identity functions to denote whether a sentence is from high resource (source) and low resource (target), respectively; α is a weighting factor to balance the loss contribution from high and low resource; the parameter (1 − r i ) γ (or r γ i ) controls the loss contribution from individual samples by measuring the discrepancy between prediction and true label (easy samples have smaller contribution); and γ scales the contrast of loss contribution from hard and easy samples. In practice, the value of γ does not need to be tuned much and usually set as 2 in our experiment. Intuitively, the weighting factors α and (1 − r i ) γ reduce the loss contribution from high resource and easy samples, respectively. Note that though the resource classifier is optimized to minimize the resource classification error, when the gradients originated from the resource classification loss are back-propagated to the other model parts than the resource classifier, they are negated for parameter updates so that these bottom layers are trained to be resource-agnostic.

Label Decoder
The label decoder induces a probability distribution over sequences of labels, conditioned on the word-level encoder features. In this paper, we use a linear chain model based on the first-order Markov chain structure, termed the chain conditional random field (CRF) (Lafferty et al., 2001), as the decoder. In this decoder, there are two kinds of cliques: local cliques and transition cliques. Specifically, local cliques correspond to the individual elements in the sequence. And transition cliques, on the other hand, reflect the evolution of states between two neighboring elements at time t − 1 and t and we define the transition distribution as θ. Formally, a linear-chain CRF can be written as p(y|h 1:T ) = where Z(h 1:T ) is a normalization term and y is the sequence of predicted labels as follows: y = y 1:T . Model parameters are optimized to maximize this conditional log likelihood, which acts as the objective function of the model. We define the loss function for source and target resources as follows, S = − i log p(y|h 1:T ), T = − i log p(y|h 1:T ).

Adversarial Training
So far our model can be trained end-to-end with standard back-propagation by minimizing the following loss: Recent works have demonstrated that deep learning models are fragile to adversarial examples (Goodfellow et al., 2015). In computer vision, those adversarial examples can be constructed by changing a very small number of pixels, which are virtually indistinguishable to human perception (Pin-Yu et al., 2018). Recently, adversarial samples are widely incorporated into training to improve the generalization and robustness of the model, which is so-called adversarial training (AT) (Miyato et al., 2017). It emerges as a powerful regularization tool to stabilize training and prevent the model from being stuck in local minimum. In this paper, we explore AT in context of NER. To be specific, we prepare an adversarial sample by adding the original sample with a perturbation bounded by a small norm to maximize the loss function as follows: where Θ is the current model parameters set. However, we cannot calculate the value of η exactly in general, because the exact optimization with respect to η is intractable in neural networks. Following the strategy in (Goodfellow et al., 2015), this value can be approximated by linearizing it as follows, η x = g g 2 , where g = ∇ (Θ; x) where can be determined on the validation set. In this way, adversarial examples are generated by adding small perturbations to the inputs in the direction that most significantly increases the loss function of the model. We find such η against the current model parameterized by Θ, at each training step, and construct an adversarial example by x adv = x + η x . Note that we generate this adversarial example on the word and character embedding layer, respectively, as shown in the Figure 1(b) and 1(c). Then, the classifier is trained on the mixture of original and adversarial examples to improve the generalization. To this end, we augment the loss in Eqn. 2 and define the loss function for adversarial training as: where (Θ; x), (Θ; x adv ) represents the loss from an original example and its adversarial counterpart, respectively. Note that we present the AT in a general form for the convenience of presentation. For different samples, the loss and parameters should correspond to their counterparts. For example, for the source data with word embedding w S , the loss can be defined as follows, AT = (Θ; w S )+ (Θ; w S,adv ) with w S,adv = w S +η w S and = GRAD + S . Similarly, we can compute the perturbations η c for char-embedding and η w T for target word embedding.

Datasets
In order to evaluate the performance of DATNet, we conduct the experiments on following widely used NER datasets: CoNLL-2003 English NER (Kim and De, 2003), CoNLL-2002Spanish & Dutch NER (Kim, 2002, WNUT-2016English Twitter NER (Zeman, 2017. The statistics of these datasets are described in Table 1   the CRF layer (Collobert et al., 2011;Chiu and Nichols, 2016;Yang et al., 2017) or introduce the orthographic feature as additional input for learning social media NER in tweets (Partalas et al., 2016;Limsopatham and Collier, 2016;Aguilar et al., 2017), we do not use hand-crafted features and only words and characters are considered as the inputs. Our goal is to study the effects of transferring knowledge from high-resource dataset to low-resource dataset. To be noted, we used only training set for model training for all datasets except the WNUT-2016 NER dataset. Since in this dataset, all the previous studies merged the training set and validation set together for training. Specifically, we use CoNLL-2003 English NER dataset as high-resource (i.e., source) for all the experiments, CoNLL-2002 and WNUT datasets as low-resource (i.e., target) in cross-language and cross-domain NER settings, respectively.

Experimental Setup
We use 50-dimensional publicly available pretrained word embeddings for English, Spanish and Dutch of CoNLL and WNUT datasets in our experiments, which are trained by word2vec on the corresponding Wikipedia articles (Lin et al., 2018), and the 30-dimensional randomly initialized character embeddings are used for all the datasets. We set the filters as 20 for char-level CNN and the dimension of hidden states of the word-level LSTM as 200 for both base model and DATNet-F. For DATNet-P, we set 100 for source, share, and target LSTMs, respectively. Parameters optimization is performed by Adam (Kingma and Ba, 2015) with gradient clipping of 5.0 and learning rate decay strategy. We set the initial learning rate of β 0 = 0.001 for all experiments. At each epoch t, learning rate β t is updated using where ρ is decay rate with 0.05. To reduce over-fitting, we apply Dropout (Srivastava et al., 2014) to the embedding layer and the output of the LSTM layer, respectively.

Comparison with State-of-The-Art Results
In this section, we compare our approach with state-of-the-art methods on CoNLL and WNUT benchmark datasets. Note that our models do not use any additional large-scale language resources, so we do not consider the language models (Peters et al., 2018;Radford, 2018;Devlin et al., 2018) for fair comparison. In the experiment, we exploit all the source data (i.e., CoNLL-2003 English NER) and target data to improve performance of target tasks. The averaged results with standard deviation over 10 repetitive runs are summarized in Table 2, and we also report the best results on each task for fair comparison with other SOTA methods. From results, we observe that incorporating the additional resource is helpful to improve performance. DATNet-P achieves the highest F1 score on CoNLL-2002 Spanish and sec-

Transfer Learning Performance
In this section, we investigate on improvements with transfer learning under multiple low-resource settings with partial target data. To simulate a lowresource setting, we randomly select subsets of target data with varying data ratio at 0.05, 0.1, 0.2, 0.4, 0.6, and 1.0. The results for cross-language and cross-domain transfer are shown in Figure  2(a) and 2(b), respectively, where we compare the results with each part of DATNet under various data ratios. From those figures, we have the following observations: 1) both adversarial training and adversarial discriminator in DATNet consistently contribute to the performance improvement; 2) the transfer learning component in the DATNet consistently improves over the base model results 1 We are not sure whether (Feng et al., 2018) has incorporated the validation set into training. And if we merge training and validation sets, we can push the F1 score to 88.71. and the improvement margin is more substantial when the target data ratio is lower. For example, when the data ratio is 0.05, DATNet-P model outperforms the base model by more than 4% absolutely in F1-score on Spanish NER and DATNet-F model improves around 13% absolutely in F1score compared to base model on WNUT-2016 NER.
In the second experiment, we further investigate DATNet on the extremely low resource cases, e.g., the number of training target sentences is 10, 50, 100, 200, 500 and 1,000. The setting is quite challenging and fewer previous works have studied before. The results are summarized in Table 3. We have two interesting observations: 1) DATNet-F outperforms DATNet-P on cross-language transfer when the target resource is extremely low, however, this situation is reversed when the target dataset size is large enough (here for this specific dataset, the threshold is 100 sentences); 2) DATNet-F is always superior to DATNet-P on cross-domain transfer. For the first observation, DATNet-F with more shared hidden units is more efficient to transfer knowledge than DATNet-P when data size is extremely small. For the second observation, because cross-domain transfer are in the same language, more knowledge is common between source and target domains, requiring more shared hidden features to carry with these knowledge compared to cross-language transfer. Therefore, for cross-language transfer with extremely low resource and cross-domain transfer, we suggest using DATNet-F to achieve better performance. As for cross-language transfer with relatively more training data, DATNet-P is preferred.

Ablation Study of DATNet
In the proposed DATNet, both GRAD and AT play important roles in low resource NER. In this experiment, we further investigate how GRAD and AT help to transfer knowledge across language/domain. In the first experiment, we used t-SNE (Maaten and Hinton, 2008) to visualize the feature distribution of BiLSTM outputs without AD, with normal AD (GRAD without considering data imbalance), and with the proposed GRAD in Figure 3. From this figure, we can see that GRAD in DATNet makes the distribution of extracted features from source and target datasets much more similar by considering data imbalance, which indicates that the outputs are resource-invariant.
To better understand the working mechanism, Table 4 further reports the quantitative performance comparison between models with different components. We observe that GRAD shows the stable superiority over the normal AD regardless of other components. There is not always a winner between DATNet-P and DATNet-F on different settings. DATNet-P architecture is more suitable to cross-language transfer while DATNet-F is more suitable to cross-domain transfer.
From the previous results, we know that AT helps enhance the overall performance by adding perturbations to inputs with the limit of = 5, i.e., η 2 ≤ 5. In this experiment, we further investigate how target perturbation w T with fixed source perturbation w S = 5 in AT affects knowledge transfer and the results on Spanish NER are summarized in Table 6. The results generally indicate that less training data require a larger to prevent over-fitting, which further validates the necessity of AT in the case of low resource data.
Finally, we analyze the discriminator weight α in GRAD and results are summarized in Table 5. From the results, it is interesting to find that α is directly proportional to the data ratio ρ, basically, which means that more target training data requires larger α (i.e., smaller 1−α to reduce training emphasis on the target domain) to achieve better performance.

Conclusion
In this paper we develop a transfer learning model DATNet for low-resource NER, which aims at addressing representation difference and resource data imbalance problems. We introduce two variants, DATNet-F and DATNet-P, which can be chosen according to cross-language/domain user case and target dataset size. To improve model generalization, we propose dual adversarial learning strategies, i.e., AT and GRAD. Extensive experiments show the superiority of DATNet over existing models and it achieves significant improvements on CoNLL and WNUT NER benchmark datasets.