Question: Represent the next text

Question: Recent work has shown that contextualized word representations derived from neural machine translation (NMT) are a viable alternative to such from simple word predictions tasks. This is because the internal understanding that needs to be built in order to be able to translate from one language to another is much more comprehensive. Unfortunately, computational and memory limitations as of present prevent NMT models from using large word vocabularies, and thus alternatives such as subword units (BPE and morphological segmentations) and characters have been used. Here we study the impact of using different kinds of units on the quality of the ing representations when used to model syntax, semantics, and morphology. We found that while representations derived from subwords are slightly better for modeling syntax, character-based representations are superior for modeling morphology and are also more robust to noisy input. Recent years have seen the rise of deep neural networks and the subsequent rise of representation learning based on network-internal activations. Such representations have been shown useful when addressing various problems from fields such as image recognition, speech recognition BID2, and natural language processing (NLP) BID30. The central idea is that the internal representations trained to solve an NLP task could be useful for other tasks as well. For example, word embeddings learned for a simple word prediction task in context, word2vec-style BID31, have now become almost obligatory in state-ofthe-art NLP models. One issue with such word embeddings is that the ing representation is context-independent. Recently, it has been shown that huge performance gains can be achieved by contextualizing the representations, so that the same word could have a different embedding in different contexts. This is best achieved by changing the auxiliary task, e.g., the ElMo model learns contextualized word embeddings from a language modeling task, using LSTMs BID37.More recently, it has been shown that complex tasks such as neural machine translation can yield superior representations BID29. This is because the internal understanding of the input language that needs to be built by the network in order to be able to translate from one language to another needs to be much more comprehensive compared to what would be needed for a simple word prediction task. Such representations have yielded state-of-the-art for tasks such as sentiment analysis, textual entailment, and question answering. Unfortunately, computational and memory limitations as of present prevent neural machine translation (NMT) models from using large-scale vocabularies, typically limiting them to 30-50k words. This is a severe limitation, as most NLP applications need to handle vocabularies of millions of words, e.g., word2vec BID31, GloVe BID36 and FastText BID32 offer pre-trained embeddings for 3M, 2M, and 2.5M words/phrases, respectively. The problem is typically addressed using byte-pair encoding (BPE), where words are segmented into pseudo-word character sequences based on frequency BID43. A somewhat less popular solution is to use characters as the basic unit of representation BID8. In the case of morphologically complex languages, another alternative is to reduce the vocabulary by using unsupervised morpheme segmentation BID6 ).The impact of using different units of representation in NMT models has been studied in previous work BID27 BID10 BID8 , among others), but the focus has been exclusively on the quality of the ing translation output. However, it remains unclear what input and output units should be chosen if we are primarily interested in representation learning. Here, we aim at bridging this gap by evaluating the quality of NMT-derived embeddings originating from units of different granularity when used for modeling morphology, syntax, and semantics (as opposed to end tasks such as sentiment analysis and question answering). Our contributions can be summarized as follows:• We study the impact of using words vs. characters vs. BPE units vs. morphological segments on the quality of representations learned by NMT models when used to model morphology, syntax, and semantics.• We further study the robustness of these representations with respect to noise.• We make practical recommendations based on our . We found that while representations derived from morphological segments are better for modeling syntax, character-based ones are superior for morphology and are also more robust to noise. Representation analysis aims at demystifying what is learned inside the neural network black-box. This includes analyzing word and sentence embeddings BID1 BID39 BID12 , among others), RNN states (a; BID44 BID52 BID50, and NMT representations BID44 BID4, as applied to morphological BID39 BID49, semantic BID39 and syntactic BID28 BID47 BID9 tasks. While previous work focused on words, here we compare units of different granularities. Subword translation units aim at reducing vocabulary size and OOV rate. NMT researchers have used BPE units BID43, morphological segmentation BID6, characters, and hybrid units BID27 BID10 . There have also been comparisons between subword units in the context of NMT BID42 . Unlike this work, here we focus on representation learning rather than on translation quality. Robustness to noise is an important aspect in machine learning. It has been studied for various machine learning models BID46 BID15, including NLP models BID34 BID41 BID11 BID13 BID21, and character-based NMT models BID17 BID3 . Unlike the above work, we compare robustness to noise for units of different granularity. Moreover, we focus on representation learning rather than translation. Our methodology is inspired by research on interpreting neural network (NN) models. A typical framework involves extracting feature representations from different components (e.g., encoder/decoder) of a trained model and then training a classifier to make predictions for an auxiliary task. The performance of the trained classifier is considered to be a proxy for judging the quality of the extracted representations with respect to the particular auxiliary task. Formally, for each input word x i we extract the LSTM hidden states from each layer of the encoder/decoder. We concatenate the representations of layers and we use them as feature vector z i for the auxiliary task. We train a logistic regression classifier by minimizing the cross-entropy loss: DISPLAYFORM0 is the probability that word x i is assigned label l. The weights θ ∈ R D×L are learned with gradient descent. Here D is the dimensionality of the latent representations z i and L is the size of the label set for P. We consider four representation units: words, byte-pair encoding (BPE) units, morphological units, and characters. TAB0 shows an example of each representation unit. BPE splits words into symbols (a symbol is a sequence of characters) and then iteratively replaces the most frequent sequences of symbols with a new merged symbol. In essence, frequent character n-gram sequences merge to form one symbol. The number of merge operations is controlled by a hyper-parameter OP, which directly affects the granularity of segmentation: a high value of OP means coarse segmentation and a low value means fine-grained segmentation. For morphologically segmented units, we use an unsupervised morphological segmenter, Morfessor BID45. Note that although BPE and Morfessor segment words at a similar level of granularity, the segmentation generated by Morfessor is linguistically motivated. For example, it splits the gerund shooting into base verb shoot and the suffix ing. Compare this to the BPE segmentation sho + oting, which has no linguistic justification. On the extreme, the fully character-level units treat each word as a sequence of characters. Extracting Activations for Subword and Character Units Previous work on analyzing NMT representations has been limited to the analysis of word representations only, 1 where there is a oneto-one mapping from input units (words) and their NMT representations (hidden states) to their linguistic annotations (e.g., morphological tags). In the case of subword-based systems, each word may be split into multiple subword units, and each unit has its own representation. It is less trivial to define which representations should be evaluated when predicting a word-level property. We consider two simple approximations to estimate a word representation from subword representations: (i) Average: for each word, average the activation values of all the subwords (or characters) comprising it. In the case of a bi-directional encoder, we concatenate the averages from the forward and the backward activations of the encoder on the subwords (or characters) that represent the current word. (ii) Last: consider the activation of the last subword (or character) as the representation of the word. For the bi-directional encoder, we concatenate the forward encoder's activation on the last subword unit with the backward encoder's activation on the first subword unit. This formalization allows us to analyze character-and subword-based representations at the word level via prediction tasks. Such kind of analysis has not been performed before. We choose three fundamental NLP tasks that serve as a good representative of various properties inherent in a language, ranging from morphology (word structure), syntax (grammar) and semantics (meaning). In particular, we experiment with morphological tagging for German, Czech, Russian and English 2 languages, lexical semantics tagging for English and German languages, and syntactic tagging via CCG supertagging for English language. TAB1 shows an example sentence with annotations of each task. The morphological tags capture word structure, semantic tags show semantic property, and syntax tags (CCG super tags) captures global syntactic information locally at the lexical level. For example in TAB1, -the morphological tag VBZ for the word "receives", marks that it is a verb with non-third person singular present property, the semantic tag ENS describes a present simple event category, and the syntactic tag S[dcl]\NP)/NP indicates that the preposition "in" attaches to the verb. Recent studies have shown that small perturbations in the input can cause significant deterioration in the performance of the deep neural networks. Here, we evaluate the robustness of various representations under noisy input conditions. We use corpora of real errors harvested by BID3. The errors contain a good mix of typos, misspellings, and other kinds of errors. In addition, we create data with synthetic noise. We induced two kinds of errors: i) Swap and Middle. Swap is a common error which occurs when neighboring characters are mistakenly swapped (e.g., word → wodr). In Middle errors, the order of the first and the last characters of a word are preserved while the middle characters are randomly shuffled BID40 ) (e.g., example→ eaxmlpe). We corrupt (using swap or middle) or replace (using real errors corpora) n% words randomly in each test sentence. We then re-extract feature vectors for the erroneous words in a sentence and re-evaluate the prediction capability of these embeddings on the linguistic tasks. Data and Languages: We trained NMT systems for 4 language pairs: German-English, CzechEnglish, Russian-English and English-German, using data made available through the two popular machine translation campaigns, namely, WMT BID5 and IWSLT BID7. The MT models were trained using a concatenation of NEWS and TED training data. We used official TED testsets (testsets-11-13) to report translation quality BID35. The morphological classifiers were trained and tested on a concatenation of NEWS and TED testsets, which were automatically tagged as described in the next section. Semantic and syntactic classifiers were trained and tested on existing annotated corpora. Statistics are shown in TAB2.Taggers: We used RDRPOST to annotate data for the classifier. For semantic tagging, we used the the Groningen Parallel Meaning Bank BID0. The tags TAB2 for statistics. We used seq2seq-attn BID23 to train 2-layered attentional long short-term memory (LSTM) BID18 encoder-decoder systems with bidirectional encoder. We used 500 dimensions for both word embeddings and LSTM states. We trained systems with SGD for 20 epochs and used the final model for generating features for the classifier. We trained the systems in both *-to-English and English-to-* directions and analyze the representations from both encoder and decoder. To analyze the encoder-side, we fix the decoder-side with BPE-based embeddings and train the source-side with word/BPE/Morfessor/char units. Similarly, to analyze the decoder-side, we train the encoder representation with BPE units and vary the decoder side with different input units. Our motivation for this setup is to analyze representations in isolation keeping the other half of the network static across different settings. We use 50k BPE operations and limit the vocabulary of all systems to 50k. The word/BPE/Morfessor/characterbased systems were trained with sentence lengths of 80/100/100/400, respectively. The classifier is a logistic regression whose input is either hidden states in word-based models, or Last or Average representations in character-and subword-based models. Since we concatenate forward and backward states from all layers, this ends up being 2000/1000 dimensions when classifying the encoder/decoder: 500 dimensions×2 layers×2 directions (1 for decoder). The classifiers are trained for 10 epochs. The encoder models are trained with BPE as target and the decoder models with BPE as a source. We now present the of using representations learned from different input units on the task of predicting morphology, semantics and syntax. For subword and character units, we found that the activation of the last subword/character unit of a word consistently better than using the average of all activations. So we present the using Last method only and discuss this more later. FIG0 summarizes the for predicting morphological tags with representations learned using different units. The character-based representations consistently outperformed other representations on all language pairs while the word-based representations achieved the lowest accuracy. The differences are more significant in the case of languages with relatively complex morphology, Czech and Russian. We see a difference of up to 14% in favor of using character-based representations when compared with the word-based representations. The improvement is minimal in the case of English (1.2%), which is a morphologically simpler language. Comparing subword units as obtained using Morfessor and BPE, we found Morfessor to give much better morphological tagging performance especially in the case of morphologically rich languages, Czech and Russian. This is due to the linguistically motivated segmentations which are helpful in for learning language morphology. We further investigated whether the performance difference between various representation is due to the difference in modeling infrequent and out-of-vocabulary words. TAB4 shows the OOVs rate of each language which is higher for morphologically rich languages. Figure 2 shows that the gap between different representations is inversely related to the frequency of the word in the training data: character-based models perform much better than others on less frequent and OOV words. Decoder Representations: Next, we used the decoder representations from the English-to-* models. We saw a similar performance trend as in the case of encoder-side representations, character units performed the best while word units performed the worst. Also morphological units performed better than the BPE-based units. Comparing encoder representation with decoder representation, it is interesting to see that in several cases the decoder-side representations performed better than the encoder-side representations, even though they are trained using a uni-directional LSTM only. Since we did not see any difference in trend between encoder and decoder side representations, we only present the encoder side in the later part of the paper. Figure 3 summarizes the on the semantic tagging task. On English, subword-based (BPE and Morfessor) representations and character-based representation achieve comparable . However, for German, BPE-based representations performed better than the other representations. These contrast to morphology prediction , where character-based representations were consistently better compared to their subword-based counterparts. The final property we evaluate is CCG super-tagging, reflecting syntactic knowledge. Here we only have English tags, so we evaluate encoder representations from English→German models, trained with words, characters, and subwords. We found that morphologically segmented representation units perform the best while words and BPE-based representations perform comparable. The characters-based representations lag behind, though the difference between accuracy is small compared to the morphological tagging . 4 It is noteworthy that characters perform below both words and subwords here, contrary to their superior performance on the task of morphology. We will return to this point in the discussion in Section 6. We now evaluate the robustness of the representations towards noise. We induce errors in the testsets by corrupting 25% of the words in each sentence using different error types (synthetic or real noise), as described in Section 3.3. We extract the representations of the noisy testsets and re-evaluate the classifiers. FIG2 shows the performance on each task. Evidently, characters yield much better performance on all tasks and for all languages, showing minimal drop in the accuracy, in contrast to earlier where they did not outperform subword units 5 on the task of syntactic tagging. This shows character-based representations are more robust towards noise compared to others. Surprisingly in a few cases, BPE-based representations performed even worst than word-based representations, e.g. in the case of Syntactic tagging (80.3 vs. 81.1). We hypothesize that BPE segments a noisy word into two known subword units that may have no close relationship with the actual word. Using representations of wrong subword units ed in a significant drop in performance. We further investigated the robustness of each classifier by increasing the percentage of noise in the test data and found that the difference in representation quality stays constant across BPE and Comparing Performance Across Tasks Character-based representations outperformed in the case of morphological tagging; BPE-based representations performed better than others in the semantic tagging task for German (and about the same in English); and Morfessor performed slightly better than others for syntax. Syntactic tagging requires knowledge of the complete sentence. Splitting a sentence into characters substantially increases the length (from 50 words in a sentence to 250 characters on average) of the sentence. The character-based models lack in capturing long distance dependencies, which could be a reason for their low performance in this task. Similarly, in case of morphological tagging, the information about the morphology of a word is dependent on the surrounding words plus internal information (root, morphemes etc.) presents in the word. The character-based system has access to all of this information which in high tagging performance. Morfessor performed better than BPE in the morphological tagging task because its segments are linguistically motivated units (segmented into root + morphemes), making the information about the word morphology explicit in the representation. In comparison, BPE solely focuses on the frequency of characters occurring together in the corpus and can yield linguistically incorrect units. TAB3 summarizes the translation performance of each system. In most of the cases, the subword-based systems perform better than the word-based and character-based systems. However, this is not true in the case of using their representations as feature in the core NLP tasks. For example, we found that character-based representations perform better than others in the morphological tagging task. On an additional note, BPE-based representations although perform better for some tasks, are sensitive to noise. Their ability to segment any unknown words into two known subwords in less reliable systems. Notably, the translation performance of the BPE-based system falls below the character-based system even with 10% noise only. The variation in the performance of the representations reflect that they may be learning different aspects of the language. To investigate whether representations are complementary to each other, we train the classifier on their concatenation. TAB5 summarizes the on the morphological tagging task. The performance of the classifier improved in all combinations of representations while the best are achieved using all three units together. We studied the impact of using different representation units -words, characters, BPE units, and morphological segments on the representations learned by NMT. Unlike previous work, which targeted end tasks such as sentiment analysis and question answering, here we focused on modeling morphology, syntax and semantics. We found that (i) while representations derived from subwords units are slightly better for modeling syntax, (ii) character representations are distinctly better for modeling morphology, and (iii) are also more robust to noise in contrast to subword representations, (iv) and that using all representations together works best. Based on our findings, we conjecture that although BPE segmentation is a de-facto standard in building state-of-the-art NMT systems, the underlying representations it yields are suboptimal for external tasks. Character-based representations provide a more viable and robust alternative in this regard, followed by morphological segmentation. In future work, we plan to explore specialized character-based architectures for NMT. We further want to study how different units affect representation quality in non-recurrent models such as the Transformer BID48 and in convolutional architectures BID14.A SUPPLEMENTARY MATERIAL

Represent the TLDR for finding the corresponding scientific article

We study the impact of using different kinds of subword units on the quality of the resulting representations when used to model syntax, semantics, and morphology.

Represent the short summary for finding the corresponding scientific article (long)


Question: Represent the scientific article to find a short TLDR

Question: Few-shot learning is the process of learning novel classes using only a few examples and it remains a challenging task in machine learning. Many sophisticated few-shot learning algorithms have been proposed based on the notion that networks can easily overfit to novel examples if they are simply fine-tuned using only a few examples. In this study, we show that in the commonly used low-resolution mini-ImageNet dataset, the fine-tuning method achieves higher accuracy than common few-shot learning algorithms in the 1-shot task and nearly the same accuracy as that of the state-of-the-art algorithm in the 5-shot task. We then evaluate our method with more practical tasks, namely the high-resolution single-domain and cross-domain tasks. With both tasks, we show that our method achieves higher accuracy than common few-shot learning algorithms. We further analyze the experimental and show that: 1) the retraining process can be stabilized by employing a low learning rate, 2) using adaptive gradient optimizers during fine-tuning can increase test accuracy, and 3) test accuracy can be improved by updating the entire network when a large domain-shift exists between base and novel classes. Previous studies have shown that high image classification performance can be achieved by using deep networks and big datasets (; ; ;). However, the performances of these algorithms rely heavily on extensive manually annotated images, and considerable cost is often incurred in preparing these datasets. To avoid this problem, few-shot learning, which is a task of learning novel classes using only a few examples, has been actively researched. However, few-shot learning remains a considerably challenging task in machine learning, and classification accuracy in few-shot tasks is much lower than that of the many-shot regime. This is because a network pretrained using base classes must adapt to novel classes using only a few examples. The simplest means of overcoming this difficulty is to fine-tune the network using novel classes. However, the number of trainable parameters of deep networks is so large that we believe that networks can easily overfit to novel classes if we simply fine-tune the networks using only a few examples. For example, the number of trainable parameters in the ResNet-152 is approximately 60 M, which is much greater than the number of novel examples (e.g., 25 for 5-way 5-shot learning), and this leads us to the idea of overfitting. Using various sophisticated methods, numerous studies have been conducted to prevent networks from overfitting. However, the performance of a naive fine-tuning method has not been well investigated, and has pointed out that performance of this method had been underestimated in previous studies. Therefore, in this study, we analyze the performance of a fine-tuning method and show that it can achieve higher classification accuracy than common few-shot learning methods and, in some cases, can achieve an accuracy approximating that of the state-of-the-art algorithm. We also experimentally show that: 1) a low learning rate stabilizes the retraining process, 2) using an adaptive gradient optimizer when fine-tuning the network increases test accuracy, and 3) updating the entire network increases test accuracy when a large domain shift occurs between base and novel classes. To evaluate accuracy in few-shot image classification tasks, the mini-ImageNet dataset has been used in many previous studies. This is a subset of the ImageNet dataset in which each image is resized to 84 × 84 to reduce computational cost.the high-resolution mini-ImageNet dataset and cross-domain dataset. Both datasets contain higherresolution images than the original mini-ImageNet dataset, and the cross-domain dataset represents a greater challenge because base and novel classes are sampled from different datasets. Thus, a larger domain shift occurs between these classes. In this study, we evaluate the performance of our method using the high-resolution mini-ImageNet dataset (high-resolution single-domain task) and cross-domain dataset (cross-domain task) as well as the common low-resolution mini-ImageNet dataset (low-resolution single-domain task). Details of these datasets are provided in Section 2.3. The main contributions of this study are as follows: 1) We show that in the common low-resolution single-domain task, our fine-tuning method achieves higher accuracy than common few-shot learning algorithms in the 1-shot task and nearly the same accuracy as that of the state-of-the-art method in the 5-shot task. We also show that our method achieves higher accuracy than common few-shot learning methods both in the high-resolution single-domain and cross-domain tasks. Note that we do not compare the performance of our method with the state-of-the-art algorithm in the high-resolution single-domain and cross-domain tasks because the performances for these tasks are not reported in the corresponding papers. 2) We further analyze the experimental and show that a low learning rate stabilizes the relearning process, that test accuracy can be increased by using an adaptive gradient optimizer such as the Adam optimizer, and that updating the entire network can increase test accuracy when a large domain shift occurs. 2 OVERVIEW OF FEW-SHOT LEARNING 2.1 NOTATION Few-shot learning is a task of learning novel classes using only a few labeled examples. This task is also called N -way K-shot learning, where N denotes the number of novel classes and K is the number of labeled examples per class. We focus on the 5-way learning task such as in previous studies . Labeled and unlabeled examples of novel classes are called support and query sets, respectively. A network is pretrained using base classes, which contain numerous labeled examples. Base and novel classes are mutually exclusive. Base classes are used for pretraining, and novel classes are used for retraining and testing. Validation classes are used to determine a learning rate and the number of epochs required to retrain the network. To date, numerous few-shot learning algorithms have been proposed, and these methods can be roughly classified into three categories: learning discriminative embedding using metric-based classification, learning to learn novel classes, and data-augmentation using synthetic data. Metric-learning approaches such as MatchingNet and ProtoNet tackle few-shot classification tasks by training an embedding function and applying a differentiable nearest-neighbor method to the feature space using the Euclidean metric. RelationNet was developed to replace the nearest-neighbor method with a trainable metric using convolutional and fully connected (FC) layers and has achieved higher few-shot classification accuracy. proposed a method called weight imprinting. They showed that including normalized feature vectors of novel classes in the final layer weight provides effective initialization for novel classes. We use the weight-imprinting method to initialize the last FC layer before finetuning the network. These conventional methods successfully retrain networks using novel classes while preventing overfitting, but we show that few-shot classification performance can be further improved by fine-tuning networks. Meta-learning-based approaches address the few-shot learning problem by training networks to learn to learn novel classes. focused on the similarity between gradient descent methods and long short-term memory (LSTM) , and they achieved a fast adaptation to novel classes by using LSTM to update network weights. proposed a method to train a network to obtain easily adaptable parameters so that the network can adapt to novel classes by means of a few gradient steps using only a few examples. In these algorithms, networks are explicitly trained to learn how to adapt to novel classes. However, we show that networks pretrained without explicit meta-learning methods can also learn novel classes and achieve high few-shot classification accuracy. Data-augmentation-based approaches overcome data deficiencies by generating synthetic examples of novel classes. Some methods synthesize examples of novel classes by applying withinclass differences of base classes to real examples of novel classes . integrated a feature generator using a few-shot learning process and succeeded in generating synthetic data using only a few novel examples. These methods succeeded in improving the performance of few-shot learning by using synthetic examples for retraining. Nevertheless, we show that networks can adapt to novel classes by using only naive data-augmentation methods such as image flipping and image jittering. The mini-ImageNet dataset is a well-known dataset used to evaluate few-shot learning methods. The dataset was first proposed by , but the train/validation/test split proposed by is often used instead. Therefore, we used this split in this study. This dataset is a subset of the ImageNet dataset and contains 100 classes with 600 examples of each class. The classes are split into 64 base, 16 validation, and 20 novel classes. Images in this dataset are resized to 84 × 84 to reduce computational cost. used a higher-resolution mini-ImageNet dataset with an image resolution of 224 × 224 to employ deeper networks. They also revealed that the domain shift that occurs between base and novel classes in the mini-ImageNet dataset is small because the classes are sampled in the same dataset. The authors proposed the cross-domain dataset, which has a larger domain shift between these classes. In this dataset, the whole mini-ImageNet dataset is used as a set of base classes, and randomly sampled 50 and 50 classes from the CUB-200-2011 dataset are used as validation and novel classes, respectively. These datasets are more practical because they use high-resolution images, and the cross-domain dataset is more challenging because the domain shift that occurs between base and novel classes is larger. Therefore, we use the highresolution mini-ImageNet dataset and cross-domain dataset for evaluation as well as the common low-resolution mini-ImageNet dataset. The ResNet-18/34/50/101/152 and VGG-16 without FC layers are used as feature extractors in this study. Note that the last MaxPool2d layer of the VGG-16 is replaced by the GlobalAveragePool2d layer to support different resolutions of input images. We also use the simple classifier (i.e., common FC layer) and the normalized classifier. The technique known as weight imprinting is used in the normalized classifier; the normalized classifier is illustrated in Figure 1. Before fine-tuning the normalized network for novel classes, we initialize classifier weight W by deleting the weight and inserting columns for novel classes, as shown in Figure 1. Regarding the simple classifier, the initial weight for novel classes can be obtained by applying the multi-class linear SVM to feature vectors of novel classes. We evaluated our method using the low-resolution mini-ImageNet dataset as a common evaluation dataset. In addition, we used the high-resolution mini-ImageNet and cross-domain datasets as more practical datasets. Details of these datasets are provided in Section 2.3. In this study, we identify tasks that use these datasets as low-resolution single-domain task, the high-resolution single-domain task, and cross-domain tasks.. Each column w i ∈ R d of the classifier weight is normalized so that w i has a norm of 1 (i.e., ∥w i ∥ = 1), and classification is performed by taking the inner products between w i and normalized feature vectorẑ ∈ R d. Note that variable d is the dimension of the feature space. Before the network is fine-tuned, the initial weight for a novel class can be obtained by including feature vectorẑ of the novel class in the classifier weight. When multiple novel examples per class are available (i.e., K-shot learning with K > 1), the initial weight for the novel class can be obtained by normalizing class mean 1/K ∑ K j=1ẑ j again. Because the output range of Wẑ is [−1, 1], ensuring that the probability of the correct label approximates 1 using softmax activation is difficult. This problem can be avoided by applying scale factor s ∈ R to the output, as discussed by. The networks were pretrained by using the base classes of the datasets for 600 epochs. We used the Adam optimizer with a learning rate of 0.001 in the same manner as. These parameters for pretraining are normally optimized using validation classes, but we fixed these parameters to reduce computational cost. Input images were preprocessed by random-resized cropping with a size of 224 × 224. We also performed color jittering and random-horizontal flipping, and we subtracted channel-wise means of the ImageNet dataset (0.485, 0.456, 0.406). In addition, division by channel-wise standard deviations of the ImageNet dataset (0.229, 0.224, 0.225) was performed in the same manner as. Note that in the low-resolution single-domain task, the size of the random-resized cropping was set to 84 × 84. In this study, we compared three fine-tuning methods in which: 1) the entire network is updated, 2) the classifier weight and batch-normalization (BN) statistics are updated, and 3) only the classifier weight is updated. The third method is a common fine-tuning method to prevent overfitting. The second method is based on a previous study that successfully fine-tuned an image generator to a novel class without overfitting by updating only the BN statistics (i.e., γ and β of BN layers). A similar approach is known as meta-transfer learning (MTL) . The authors who proposed MTL showed that updating only scales and biases of network parameters prevents them from overfitting while achieving efficient adaptation to unseen tasks. Although the methods proposed by and presented similar ideas, we chose the former because of its simplicity in implementation. Initial classifier weights for novel classes were obtained before we fine-tuned the networks, as discussed in Section 3.1. The networks were retrained with mini-batch-based learning with a batch size of N K in the N -way K-shot learning scenario. The learning rate and number of epochs for finetuning were determined by using validation classes. We evaluated few-shot classification accuracy by calculating the mean accuracy of 600 trials using randomly sampled classes and examples in the novel classes. We also calculated the 95% confidence interval of the mean accuracy. In the validation, test, and network initialization phases for the novel classes, input images were preprocessed by resizing to 256 × 256, center-cropping to a size of 224 × 224, subtracting channel-wise means of the ImageNet dataset (0.485, 0.456, 0.406), and dividing by channel-wise standard-deviations of the ImageNet dataset (0.229, 0.224, 0.225) in the same manner as. The input preprocessing for fine-tuning phase was the same as discussed in Section 3.3. Table 1: Performance of our method in the 5-way low-resolution single-domain task. "Normalized" and "Simple" mean that the normalized and simple classifiers are used, respectively. "All", "BN & FC", and "FC" mean the following: the entire network was updated; the BN and FC layer were updated; only the FC layers were updated. "w/o FT" refers to performance without fine-tuning using novel classes. Values with the † mark refer to classification accuracy without fine-tuning, as validation accuracy was not increased by fine-tuning the network. The * mark means that the classification accuracy for novel classes was not available because the loss value did not decrease in the pretraining phase. The -mark means that we did not conduct an experiment because the network did not have BN layers. Table 2: Performance of our method in the 5-way high-resolution single-domain task. "Normalized" and "Simple" mean that the normalized and simple classifiers were used, respectively. "All", "BN & FC", and "FC" mean the following: the entire network was updated; the BN and FC layer were updated; only the FC layers were updated. "w/o FT" refers to performance without fine-tuning using novel classes. Values with the † mark refer to classification accuracy without fine-tuning, as validation accuracy was not increased by fine-tuning the network. The * mark means that classification accuracy for novel classes was not available because the loss value did not decrease in the pretraining phase. The -mark means that we did not conduct an experiment because the network did not have BN layers. Few-shot classification accuracies for the low-resolution single-domain task, high-resolution singledomain task, and cross-domain task are listed in Tables 1, 2, and 3, respectively. Table 1 shows that the classification accuracy could be increased by approximately 6% when the VGG-16 and normalized classifier were used in the 1-shot learning task. However, the accuracy could not be further improved by updating the entire network in the 1-shot learning task. However, classification accuracy could be further improved by updating the entire network in the 5-shot task. We assume that this was because the within-class difference could be reduced by fine-tuning the feature extractor when multiple novel examples were available. By comparing the for the high-resolution single-domain (Table 2) and low-resolution (Table 1) tasks, it could be argued that the robustness against low-resolution inputs differs depending on the feature extractor. For example, by comparing the for 5-shot "Normalized all" in Table 1 and 2, we can see that the classification accuracy of the ResNet-152 decreased by 11.0% whereas that of the VGG-16 decreased by only 4.3%. This implies that the robustness against low-resolution inputs should also be considered and that evaluating only few-shot learning performance is difficult. Although the low-resolution mini-ImageNet dataset is extremely useful for doing fast experiments, we must reconsider the validity of the dataset for evaluation of few-shot learning performance. Table 3: Performance of our method in the 5-way cross-domain task. "Normalized" and "Simple" mean that the normalized and simple classifiers were used, respectively. "All", "BN & FC", and "FC" mean the following: the entire network was updated; the BN and FC layer were updated; only the FC layers were updated. "w/o FT" refers to performance without fine-tuning using novel classes. Values with the † mark refer to classification accuracy without fine-tuning, as validation accuracy was not increased by fine-tuning the network. The * mark means that classification accuracy for novel classes was not available because the loss value did not decrease in the pretraining phase. The -mark means that we did not conduct an experiment because the network did not have BN layers. Table 4: Comparison between our method and conventional methods. We show several from different networks in Section 3.5, and therefore in this table show the highest accuracy for each task. More specifically, we use the from "VGG-16 Normalized FC", "VGG-16 Normalized All", "VGG-16 Normalized FC", "ResNet-50 Normalized All", and "ResNet-50 Normalized All" from left to right in this table. Values with the ‡ marks were reported by , and other values were reported in the original studies. The -mark means that the classification accuracy for the task was not reported. 59.9 69.7 --- The comparison of the from the cross-domain task (Table 3) and high-resolution singledomain task shows that the performance decreased in the cross-domain task. This can be explained by the larger domain shift that occurs between base and novel classes, as indicated by. In addition, the difference in classification accuracy between the cross-domain task and high-resolution single-domain task was decreased by fine-tuning the entire network. For example, in the 5-shot learning task using the VGG-16, the difference in classification accuracy between the single-domain and cross-domain tasks was 15.9% without fine-tuning, but it could be reduced to 6.9% by fine-tuning the entire network. This means that the network could adapt to a large domain shift by having the entire network updated. We discuss this further in greater detail in Section 3.7. 3.6 COMPARATIVE EVALUATION Table 4 shows comparative of ours and previous methods. Note that we use the best for each task as given in Section 3.5 because we obtained several from different networks. In the 1-shot low-resolution single-domain task, the classification accuracy was lower than that of the state-of-the-art algorithm, but it was still higher than those of other common few-shot learning methods such as MatchingNet and ProtoNet. It is interesting to note that our method achieved nearly the same classification accuracy as that of the state-of-the-art method in the 5-shot task. The reason for the higher performance in the 5-shot task may be that the within-class variance could be reduced by fine-tuning the entire network using several examples per class. In addition, we achieved higher classification accuracy than the reported values of conventional methods both in the high-resolution single-domain and cross-domain tasks. The difference in classification accuracy between the 5-shot high-resolution single-domain and cross-domain tasks was only approximately 5% with our method, whereas the performance of the conventional methods decreased by more than 10% in the cross-domain task. This shows that our method successfully We used the ResNet-18, normalized classifier, and Adam optimizer. We chose the 5-shot cross-domain task for visualization because the transition of validation accuracy is clearer than in other tasks. We set the learning rates as 0.01, 0.001, and 0.0001, and conducted four trials with randomly selected validation classes and support sets. Note that classification accuracy can be significantly changed by the randomly selected classes and samples. Therefore, we focused on the transition of the validation accuracy rather than the validation accuracy itself. reduced the effect of a large domain shift in the cross-domain task by updating the entire network for novel classes. We revealed in Section 3.5 and 3.6 that the fine-tuning method achieved high few-shot classification accuracy in many cases. In this section, we discuss the means of improving the performance of the fine-tuning method. We experimentally show that: • Using a low learning rate for fine-tuning stabilizes the retraining process. • Using adaptive gradient optimizers such as Adam increases the classification accuracy. • Higher performance can be obtained by updating the entire network when a large domain shift occurs. A learning rate is a critical parameter in training a network; this is also true for fine-tuning for fewshot learning. Figure 2 shows that the retraining process can be stabilized by using a lower learning rate. For example, the transition of the validation accuracy was unstable when the learning rate was set as 0.01 and 0.001. However, the validation accuracy increased in a stable manner when the learning rate was set as 0.0001, which is lower than that used in the pretraining phase (lr = 0.001). This means that the learning rate for few-shot fine-tuning should be set low. Here, we show that optimizers affect few-shot classification performance when the network is , RMSprop , Momentum-SGD, and ASGD . Of these, Adam, Adamax, Adadelta, Adagrad, and RMSprop are known as adaptive gradient methods. Figure 3 shows the classification accuracies for a 5-shot high-resolution single-domain task using the ResNet-18 with different optimizers. The show that higher classification accuracies could be obtained by using adaptive gradient optimizers, particularly when the normalized classifier was used. Although revealed that local minima obtained by the Adam optimizer lack a generalization ability, our experimental show that this was not necessarily true for few-shot learning. Why this occurs in few-shot learning is interesting, but this is beyond the scope of this study. Therefore, we leave this interesting direction for future works. Updating the Entire Network for Adaptation to a Large Domain Shift Figure 4 shows the relationship between test accuracy and the updated parts of the network. This shows that updating the entire network achieves higher accuracy, particularly when the normalized classifier is used. Considering the for the high-resolution single-domain task, when test accuracy was not further increased by updating the entire network, it could be argued that updating the entire network when a large domain shift occurs between base and novel classes is preferable. In this study, we showed that in the low-resolution single-domain task, our fine-tuning method achieved higher accuracy than common few-shot learning methods in the 1-shot task and nearly the same accuracy as the state-of-the-art method in the 5-shot task. We also evaluated our method with more practical tasks, such as the high-resolution single-domain and cross-domain tasks. In both tasks, our method achieved higher accuracy than common few-shot learning methods. We then experimentally showed that: 1) a low learning rate stabilizes the retraining process, 2) adaptive gradient optimizers such as Adam improve test accuracy, and 3) updating the entire network in higher accuracy when a large domain shift occurs. We believe that these insights into fine-tuning for few-shot learning tasks will help our community tackle this challenging task.

Represent the TLDR for finding the corresponding scientific article:

An empirical study that provides a novel perspective on few-shot learning, in which a fine-tuning method shows comparable accuracy to more complex state-of-the-art methods in several classification tasks.

Represent this text to find a much much longer article about it with say hundreds-thousands of words

Deep neural networks trained with data augmentation do not require any other explicit regularization (such as weight decay and dropout) and exhibit greater adaptaibility to changes in the architecture and the amount of training data.


Question: represent the article for finding a single-sentence tldr.

Question: We propose an approach to generate realistic and high-fidelity stock market data based on generative adversarial networks. We model the order stream as a stochastic process with finite history dependence, and employ a conditional Wasserstein GAN to capture history dependence of orders in a stock market. We test our approach with actual market and synthetic data on a number of different statistics, and find the generated data to be close to real data. Financial markets are among the most well-studied and closely watched complex multiagent systems in existence. Well-functioning financial markets are critical to the operation of a complex global economy, and small changes in the efficiency or stability of such markets can have enormous ramifications. Accurate modeling of financial markets can support improved design and regulation of these critical institutions. There is a vast literature on financial market modeling, though still a large gap between the state-of-art and the ideal. Analytic approaches provide insight through highly stylized model forms. Agent-based models accommodate greater dynamic complexity, and are often able to reproduce "stylized facts" of real-world markets BID10. Currently lacking, however, is a simulation capable of producing market data at high fidelity and high realism. Our aim is to develop such a model, to support a range of market design and analysis problems. This work provides a first step, learning a high-fidelity generator from real stock market data streams. Our main contribution is an approach to produce stock market data that is close to real market data, using a Wasserstein generative adversarial network (WGAN). There are many challenges that we overcome as part of this contribution. The first is how to represent a stream of stock market orders as data that can be used in a WGAN. Towards this end, we assume the stock market data stream to arise from a stochastic process with finite (but long) memory dependence. The stochastic process view also makes precise the conditional distribution that the generator is learning as well the joint distribution that the critic of the WGAN distinguishes by estimating the earth-mover distance. The second main challenge is the design of the network architecture. We choose a conditional WGAN to capture the history dependence of the stochastic process, with both the generator and critic conditional on history of orders and the time of day. A single LSTM layer is used to summarize the history succinctly. The internal architecture of both the generator and critic uses a standard convolutional structure. The generator outputs the next stock market order as well as how this order changes the active orders in the market. Part of the generator output, which updates the active market orders, is produced using a pre-trained network to approximate the deterministic buy and sell order matching in the stock market. Finally, we experiment with synthetic and real market data. The synthetic data is produced using a stock market simulator that has been used in several agent-based financial studies. The real data was obtained from OneMarketData, a financial data provider and publisher of the OneTick database product. We evaluate the generated data using various statistics such as the distribution of price and quantity of orders, inter-arrival times of orders, and the best bid and best ask evolution over time. We find the generated data matches the corresponding statistics in real data (simulated or actual stock market) closely. WGAN is a popular and well-known variant of GANs BID7. Most prior work on generation of sequences using GANs has been in the domain of text generation BID12 BID17. However, since the space of word representations is not continuous, the semantics change with nearby word representation, and given a lack of agreement on the metrics for measuring goodness of sentences, producing good quality text using GANs is still an active area of research. Stock market data does not suffer from this representation problem but the history dependence for stock markets can be much longer than for text generation. In a sequence of recent papers, BID15 have introduced GAN-based methods for generating point processes. The proposed methods generate the time for when the next event will occur. The authors have also explored the use of these techniques to generate the time for transaction events in stock markets. Our problem is richer as we aim to generate the actual limit orders including time, order type, price, and quantity information. Deep neural networks and machine learning techniques have been used on financial data mostly for prediction of transaction price BID9 BID3 BID13 and for prediction of actual returns BID0. As stated, our goal is not market prediction per se, but rather market modeling. Whereas the problems of learning to predict and generate may overlap (e.g., both aim to capture regularity in the domain), the evaluation criteria and end product are quite distinct. The stock market is a venue where equities or stocks of publicly held companies are traded. Nearly all stock markets follow the continuous double auction (CDA) mechanism BID6. Traders submit bids, or limit orders, specifying the maximum price at which they would be willing to buy a specified quantity of a security, or the minimum price at which they would be willing to sell a quantity. 1 The order book is a store that maintains the set of active orders: those submitted but not yet transacted or canceled. CDAs are continuous in the sense that when a new order matches an existing (incumbent) order in the order book, the market clears immediately and the trade is executed at the price of the incumbent order-which is then removed from the order book. Orders may be submitted at any time, and a buy order matches and transacts with a sell order when the limits of both parties can be mutually satisfied. For example, as shown in FIG0 if a limit buy order with price $10.01 and quantity 100 arrives and the order book has the best offered sell price at $10.01 with quantity 100 then the arriving order matches an incumbent exactly. However, the next buy order does not match any sell, and the following sell order partially matches what is then the best buy in the order book. The limit order book maintains the current active orders in the market (or the state of the market), which can be described in terms of the quantity offered to buy or sell across the range of price levels. Each order arrival changes the market state, recorded as an update to the order book. After processing any arrived order every buy price level is higher than all sell price levels, and the best bid refers to the lowest buy price level and the best ask refers to the highest sell price level. See FIG0 for an illustration. The order book is often approximated by few (e.g., ten) price levels above the best bid and ten price levels below the best ask; as these prices are typically the ones that dictate the transactions in the market. There are various kinds of traders in a stock market, ranging from individual investors to large investing firms. Thus, there is a wide variation in the nature of orders submitted for a security. We aim to generate orders for a security in aggregate (not per agent) that is close to the aggregate orders generated in a real market. We focus on generating orders and do not attempt to generate transactions in the stock market. This is justified as the CDA mechanism is deterministic and transactions can be determined exactly given a stream of orders. We model stock market orders as a stochastic process. Recall that a stochastic process is a collection of random variables indexed by a set of numbers. We view the stock market orders for a given chunk of time of day ∆t as a collection of vector valued random variable {x i} i∈N indexed by the limit order sequence number in N = {1, . . ., n}. The components of the random vector x i include the time interval d i, type of order t i, limit order price p i, limit order quantity q i, and the best bid a i and best ask b i. The time interval d i specifies the difference in time between the current order i and previous order i − 1 (in precision of milliseconds); the range of d i is finite. The type of order can be buy, sell, cancel buy, or cancel sell (represented in two bits). The price and quantity are restricted to lie within finite bounds. The price range is discretized in units of US cents and the quantity range is discretized in units of the equity (non-negative integers). The best bid and best ask are limit orders themselves and are specified by price and quantity. Observe that we assume the stochastic process depends on the discrete time of day ∆t, which we will make explicit in the next paragraph. We divide the time in a day into 25 equal intervals and ∆t refers to the index of the interval. A visual representation of x i is shown in FIG1 (a).Following the terminology prevalent for stochastic processes, the above process is discrete time and discrete space (note that discrete time in this terminology here refers to the discreteness of the index set N). We assume a finite history dependence of the current output x i, that is, P (x i | x i−1, . . ., ∆t) = P (x i | x i−1, . . ., x i−m, ∆t). Such dependence is justified by the observation that recent orders mostly determine the transactions and transaction price in the market as orders that have been in the market for long either get transacted or canceled. Further, the best bid and best ask serves as an (approximate) sufficient statistic for events beyond the history length m. While this process is not a Markov chain, it forms what is known as a higher order Markov chain, which implies that the process given by y i = (x i, . . ., x i−m+1) is a Markov chain for any given time interval ∆t. We assume that this chain formed by y i has a stationary distribution (i.e., it is irreducible and positive recurrent). A Markov chain is a stationary stochastic process if it starts with its stationary distribution. After some initial mixing time, the Markov chain does reach its stationary distribution, thus, we assume that the process is stationary by throwing away some initial data for the day. Also, for the jumps across two time intervals ∆t, we assume the change in stationary distribution is small and hence the mixing happens very quickly. A stationary process means that P (x i, . . ., x i−m+1 | ∆t) has the same distribution for any i. In practice we do not know m. However, we can assume a larger history length k + 1 > m, and then it is straightforward to check that y t = (x i, . . ., x i−k) is a Markov chain and the claims above hold with m − 1 replaced by k. We choose k = 20. Given the above stochastic process view of the problem, we design a conditional WGAN with a recurrent architecture to learn the real conditional distribution P r (x i | x i−1, . . ., x i−k, ∆t). We use the subscript r to refer to real distributions and the subscript g to refer to generated distributions. The real data x 1, x 2,... is a realization of the stochastic process. It is worth noting that even though P (x i, . . ., x i−k | ∆t) has the same distribution for any i, the realized real data sequence x i,... x i−k is correlated with any overlapping sequnce x i+k,... x i−k+k for k ≥ k ≥ −k. Our data points for training (stated in detail in the next paragraph) are sequences x i,... x i−k, and to ensure independence in a batch we make sure that the sequences chosen in a batch are sufficiently far apart. The architecture is shown in FIG1. Our proposed WGAN is conditional BID11 with both the generator and critic conditioned on a k length history and the time interval ∆t. The history is condensed to one vector using a single LSTM layer. This vector and some uniform noise is fed to a fully connected layer layer followed by a convolutional structure. The generator outputs the next x i (realization of x i) and the critic outputs one real number. Note that when training both generator and critic are fed history from real data, but when the generator executes after training it is fed its own generated data as history. As stated earlier, the generator output includes the best bid and ask. As the best bid and ask can be inferred deterministically from the current order and the previous best bid and ask (for most orders), we use another neural network (with frozen weights during GAN training) to output the best bid and ask. We call this the CDA network. The CDA network is trained separately using a standard MSE loss (see Appendix C).Critic details: When fed real data, the critic can be seen as a function c w of s i = (x i, . . ., x i−k, ∆t), where w are the weights of the critic network. As argued earlier, samples in a batch that are chosen from real data that are spaced at least k apart are i.i.d. samples of P r. Then for m samples fed to the critic, DISPLAYFORM0 When fed generated data (with the ten price levels determined from the output order and previous ten levels), by similar reasoning 1 m m i=1 c w (s i) estimates E s∼Pg (c w (s)) when the samples are sufficiently apart (recall that the history is always real data). Thus, the critic computes the Wasserstein distance between the joint distributions P r (x i, . . ., x i−k, ∆t) and P g (x i, . . ., x i−k, ∆t). Further, we use a gradient penalty term in the loss function for the critic instead of clipping weights as proposed in the original WGAN paper because of the better performance as revealed in prior work BID8.Generator details: The generator learns the conditional distribution P g (x i | x i−1, . . ., x i−k, ∆t). Along with the real history, the generator represents the distribution P g (x i, . . ., DISPLAYFORM1 The loss functions used is the standard WGAN loss function with a gradient penalty term BID8). The critic is trained 100 times in each iteration and as already stated, the notable part in constructing the training data is that for each mini-batch the sequence of orders chosen (including history) is far away from any other sequence in that mini-batch (see Appendix C for code snippets). We apply and evaluate Stock-GAN on two types of data sets composed of orders from an agentbased market simulator and from a real stock market, respectively. We describe each data set in detail and then compare key metrics and distributions of our generated orders with ground truth orders from the agent-based simulator and real stock markets. Synthetic data: We first evaluate Stock-GAN on synthetic orders generated from an agent-based market simulator. Previously adopted to study a variety of issues in financial markets (e.g., market making and manipulation), the simulator captures stylized facts of the complex financial market with specified stochastic processes and distributions BID14. We briefly describe the market simulator below. In the simulation, the market operates over a finite time horizon. Agents enter and reenter the market according to a Poisson process with an arrival rate of 0.005. On each arrival these traders submit a limit order to the market (replacing their previous order, if any), indicating the price at which they are willing to buy or sell a single unit of the security. The market environment is populated by 32 traders, representing investors. Each investor has an individual valuation for the security made up of private and common components. The common component is represented by a fundamental value, which can be viewed as the intrinsic value of the security. This fundamental value varies over time according to a mean-reverting stochastic process. The private component of value captures the preference contribution of the individual agent's reason for trading this security at the current time (e.g., investment, liquidity, diversification). The private valuations are drawn from a specified distribution at the start of a simulation. The common and private components are effectively added together to determine each agents valuation of the security. Agents accrue private value on each transaction, and at the end of the trading horizon evaluate their accumulated inventory on the basis of a prediction of the end-time fundamental. Given the market mechanism and valuation model for the simulation, investors pursue their trading objectives by executing a trading strategy in that environment. A popular trading strategy we adopt in the simulator is the zero-intelligence (ZI) strategy BID5. The ZI trader shades its bid from its current valuation of the stock by a random offset. We use about 300,000 orders generated by the simulator as our synthetic data. The price output by the simulator is normalized to lie in the interval [−1, 1].Real data: We obtained real limit-order streams from OneMarketData, who provided access for our research to their OneTick database for selected time periods and securities. The provided data streams comprise order submissions and cancellations across multiple exchanges at millisecond granularity. In experiments, we evaluate in the performance of Stock-GAN on two securities: a small capitalization stock, Patriot National (PN), and a large capitalization stock, Alphabet Inc (GOOG). The two stocks differ in several key aspects, including investment sector, market activity intensity, price range, liquidity etc., and thus their order patterns represent distinct dynamic processes. By training Stock-GAN with historical data for individual stocks, we can generate limit-order streams that capture key characteristics of each. Relative to our simulated agent-based market, the real market limit orders tend be very noisy including many orders at extreme prices far from the range where transactions occur. Since our interest is primarily on behavior that can affect market outcomes, we focus on limit orders in the relevant range near the best bid and ask. Specifically, in a preprocessing step, we eliminate limit orders that never appear within ten levels of the best bid and ask prices. In the experiment reported here, we use historical real market data of PN during one trading day in August 2016, and GOOG during one trading day in August 2017. After preprocessing, the PN daily order stream has about 20,000 orders and GOOG has about 230,000. We generate a number of orders equal to the number of real orders used to train the WGAN. We evaluate our generated order stream in comparison to real data using the following statistics:1. Price. Distribution over price for the day's limit orders, by order type.2. Quantity. Distribution over quantity for the day's limit orders, by order type.3. Inter-arrival time. Distribution over inter-arrival durations for the day's limit orders, by order type.4. Intensity evolution. Number of orders for consecutive 1000-second chunks of time.5. Best bid/ask evolution. Changes in the best bid and ask over time as new orders arrive. A note on cancellation: In our generation process, cancellation type orders are not contingent on the order book. We use a heuristic which is to match the generated cancellation order to the closest priced order in the book. Cancellations that are too far from any existing order to be a plausible match are ignored. In describing our , "real" refers to simulated or actual stock market data and "fake" refers to generated data. FIG3 presents statistics on buy orders for the three cases when the real data is simulated, PN, or GOOG. For simulated data, the price and inter-arrival distribution matches the real distribution quite closely. The quantity for the simulated data is always one, which is also trivially captured in the generated data. For PN and GOOG, the quantity distribution misses out on some peaks but gets most of the peaks in the real distribution. The inter-arrival time distribution matches quite closely (note that the axis has been scaled for inter-arrival time to highlight the peaks and show the full range of time). The price distribution matches closely for GOOG, but is slightly off for PN, which could be due to the low amount of data for PN. differences are particularly large for PN, likely due to the relatively smaller magnitude of trading volume for that stock. In FIG8, we show the change in best buy/ask as a function of time for the simulated, PN, and GOOG markets. The generated looks similar to real data in range and variation over time for simulated data. The similarity to real best bid/ask is better for GOOG than PN, which could possibly be due to more data available for GOOG.Quantitative measures: The figures till now show that the price distribution appears like a normal distribution and the inter-arrival time appears like a geometric distribution (geometric is discrete version of exponential). We fit these standard distributions to the real price and inter-arrival distribution and compare the total variation (TV) distance between the real and fitted vs real and generated Table 1: TV distance comparisons between fitted and generated distribution. IA means inter-arrival.distributions. The quantity distribution does not appear like any standard distribution, hence we do not evaluate it by fitting. The in Table 1 show that the generated price distribution is almost as close to the real one as the fitted price distribution. The generated inter-arrival distribution is much closer to the real one than the fitted price distribution. A point to note is that the actual price and quantity is a stochastic process with dependence on history, thus, the fitted distributions will not be helpful in generating the correct intensities or best bid and best ask evolution. A note on architectural choices: Various parts of our architecture were developed iteratively to improve the that we obtained in a previous iteration. The input of ∆t to the generator and critic is critical to get the time trend in the intensity for the GOOG stock. The CDA network and the best bid and ask in history was added to improve the for best bid/ask variation over time. Comparision with baseline: We also implemented a variational recurrent generative network but found its performance to be worse than our approach (shown in Appendix B). Our reveal that GANs can be used to simulate a stock market. While our are promising, there are open issues that provide for further research material. One experimental aspect is to try different size of the network in the WGAN, possibly dependent on the data size of the given stock and testing with many different variety of stocks. Another open research issue is to output cancellations in a more intelligent manner than the heuristic approach we use now. Overall, our work provides fertile ground for future research at the intersection of deep learning and finance. Below we show for buy order cancellation and sell order cancellation using the exact same measures as for the buy and sell orders in the main paper. The also are similar to buy or sell earlier. Figure 9: Simulated, PN, and GOOG submitted buy-order statistics using recurrent VAE.(a) GOOG intensity plot FIG0: Intensity of market activities for GOOG using recurrent VAE. We use the variational recurrent network as another baseline generative model. The architecture is exactly same as the work BID4. We used the code available at https: //github.com/phreeza/tensorflow-vrnn, but modified it. Our modification was to enable not forcing the output to be Gaussian as done in BID4, as those produced much worse . Instead, we use a MSE loss. We also modified the input size, etc. to make the neural network structure compatible with our problem. The exact change to the code changing the loss function is shown below:kl loss = tf kl gaussgauss (enc mu, enc sigma, prior mu, prior sigma) # we replace the maximium likelihood loss with the mse loss below mse loss = tf. losses. mean squared error (y, dec rho) return tf. reduce mean (kl loss + mse loss)The in Figure 9 for GOOG buy order only and in FIG0 for all types of GOOG orders shows that the entropy of the output is high (when comparing price and inter-arrival distributions) and the performance is worse than our GAN. In particular, the generated (fake) price distribution is wider than the real one (or the one generated by the GAN). The generated inter-arrival distribution is almost uniform over the discrete time points and not concentrated at 0. The quantity distribution matches the real one, somewhat similarly like our GAN approach, but it generates some negative values unlike our GAN approach (which could be discarded). The intensity distribution is also somewhat close to the real intensity. The are similar for other types of orders.self.net = Model (inputs = input his, outputs = output vec) optimizer = Adam (0.0001) self.net. compile (optimizer =optimizer, loss=' mean squared error ') self.net. summary Input LSTM structure for both Generator and Critic are shown below # ########## Input for both Generator and Critic ####################### # history orders of shape (self. historyLength, self. orderLength) history = Input (shape =( self. historyLength, self. orderLength), \ name=' history full') # current time slot: Integer, from 0 to 23 history input = Input (shape =(1,), name=' history time') # noise input of shape (self. noiseLength) noise input 1 = Input (shape =( self. noiseLength,), name=' noise input 1') # Real order of shape (( self. mini batch size,self. orderLength) truth input = Input (shape =( self. mini batch size,\ self. orderLength,1), name=' truth input') # lstm at Generator to extract history orders features lstm output = LSTM(self. lstm out length)(history) # lstm at Critic to extract history orders features lstm output h = LSTM(self. lstm out length,name=' lstm critic ')(history)# concatenate history features with noise gen input = Concatenate (axis=−1)([ history input, lstm output, noise input 1])The Generator structure is shown below, which includes the trained CDA network # ############ Generator ######################## # Input: gen input, shape (self. noiseLength +self. lstm out length + 1)

We propose an approach to generate realistic and high-fidelity stock market data based on generative adversarial networks.

We introduce the capacity to exploit information about the degree to which an arbitrary goal has been achieved while another goal was intended to policy gradient methods.