<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Classi cation Of Spanish Election Tweets (COSET) with neural networks</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Luis Cebrian Chulia</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sergio Ferrer Sanchez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitat Politecnica de Valencia</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2017</year>
      </pub-date>
      <fpage>43</fpage>
      <lpage>48</lpage>
      <abstract>
        <p>Obtaining information from tweets has become a eld of interest in recent years due to its power to provide information about the insights of the users when any relevant event occurs. This is useful for companies and political parties that take advantage of this information in order to plan their next actions or to know whether or not their current actions are being received well by their public. In this work we show our approach for addressing COSET shared task (a tweet classi cation problem) using neural networks trained only with the data provided. With this approach we achieve the third position in the competition.</p>
      </abstract>
      <kwd-group>
        <kwd>Neural Networks</kwd>
        <kwd>MLP</kwd>
        <kwd>RNN</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In the last ten years, social media, such as Twitter or Facebook, has experienced
a rapid growth that has changed the perspective of the socialization and public
communication [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Social media are being used as a data source to analyze
personal information about their users, such as opinions, likes or even political
leaning since their publications provide a huge amount of data about themselves.
      </p>
      <p>In Twitter, political conversation is a common topic and its in uence
increases when a General Election comes close since users speak more often about
politicians or policies to criticize or praise them. This gives a lot of
information related to how politicians or political groups are seen by citizenship. Also,
detecting the most discussed topics is a key aspect in order to know people's
concerns. As a result, this information can be used strategically during a
political campaign to focus on those topics that citizens have doubts or want to
address immediately.</p>
      <p>
        In this context, COSET [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] shared task is focused on the classi cation of a
dataset of tweets gathered during the 2015 Spanish General Election into ve
di erent classes, depending on the political topic discussed. To address this task,
we will build a system based on neural networks that will tackle this problem.
In this section we will be explaining the COSET shared task, part of the IberEval
2017 workshop. This shared task aims to classify tweets depending on the
political topic discussed. The corpus has been extracted from conversations during
the General Elections of 2015 in Spain. The dataset consists of 2242 tweets for
training, 250 for development and 624 for test. As a nal note, the tweets are
presented in Spanish.
      </p>
      <p>The di erent topics in which we have to classify the di erent tweets are:
{ Political issues. Related to the most abstract electoral confrontation.
{ Policy issues. Tweets about sectorial policies.
{ Campaign issues. Related to the evolution of the campaign.
{ Personal issues. Related to the personal life and activities of the
candidates.
{ Other issues.</p>
      <p>The distribution of tweets among the above topics is very imbalanced being
the largest class (Policy issues) of a size of approx. 1100 tweets and the smallest
(Personal issues) approx. 200 tweets in size.
3</p>
    </sec>
    <sec id="sec-2">
      <title>Experimental design</title>
      <p>In this section we will cover all the experimentation carried out. First we will
focus on feature extraction and text representation. Then we will address the
classi cation problem by describing the architectures used.
3.1</p>
      <sec id="sec-2-1">
        <title>Text preprocessing</title>
        <p>
          In order to transform the text into a continuous representation we apply some
preprocessing to clean as much as possible the data at hand. We have applied the
Tweet tokenizer from the NLTK python library [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] with the ags for removing
usernames, limiting the number of consecutive equal characters to three and
applying lower case to capital letters. Links and emails have been left untouched.
        </p>
        <p>Although usernames could seem useful, we decided to remove them because
they did not contribute to improve the overall performance of the system and
they also increased the size of the vocabulary by as much as 20%.
3.2</p>
      </sec>
      <sec id="sec-2-2">
        <title>Text representation</title>
        <p>We have approached the tweet classi cation problem in a variety of ways, most
of them with regards to the text representation issue. Here we will only name
the various alternatives we have tested. Results will be presented in next section.
As our rst approach we have tried representing the tweets with a xed length
representation:
{ Bag of n-grams. To preserve information of both the vocabulary and the
word order in the tweet.
{ Tf-Idf. To account for frequent and important words.
{ N-gram of characters. Similar to the previous approach but at character
level.</p>
        <p>
          Considering the great performance Recurrent Neural Networks (RNN) are
having while processing sequences[
          <xref ref-type="bibr" rid="ref7 ref9">7,9</xref>
          ], we have also tried with a non- xed length
representation with:
{ Word embedding. Words in tweets are represented as vectors, being those
vectors a continuous representation of words.
{ Character embedding. Similar to the word embedding but at a character
level.
3.3
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>Architecture for perceptron xed-length representation: Multilayer</title>
        <p>When dealing with xed-length representation a multilayer perceptron (MLP) is
used to tackle the classi cation problem. Due to the size of the training dataset
and the size of each sample, the expressiveness of this model is more than enough
to learn the representations explained before.</p>
        <p>The rst few experiments were carried with a two-layer perceptron with 512
units in each layer. This model su ered from over tting very quickly (99.5%
accuracy in training in 5 epochs), that is why we reduced the layer's size to
64 units each. With this con guration the over tting still occurred but it was
manageable with noise.</p>
        <p>Moreover, the best 4 models (trained with di erent initializations but
identical con guration of parameters) were combined forming an ensemble to allow
some collaboration among them in order to achieve better classi cation
performance.</p>
        <p>The combination of models has been implemented in a very straightforward
way. The output of the last layer of all models is added and averaged by the
number of models. The resulting vector is the one used to select the given class.</p>
        <p>The nal architecture (used to submit the best results) is a two-layer
perceptron with 64 units in each hidden layer. The activation function used on the
hidden layers is ReLU while the one used on the output layer is Softmax.
Gaussian noise is used on the hidden layers with 0.5 standard deviation. The model
was trained during 13 epochs feeding the model with batches of size 128. No
class weighting was used to compensate imbalanced classes.</p>
        <p>The model is fed with tweets represented as bag of n-grams with the n-gram
size up to 3. This results in a size of vocabulary of 47k. The training of this
model takes no more than 30 seconds on cpu.
3.4</p>
      </sec>
      <sec id="sec-2-4">
        <title>Architecture for variable-length representation: Recurrent neural network</title>
        <p>In the case of variable-length representation we used recurrent neural networks
(RNN). With this model, the tweets are represented as a sequence of vectors of
real numbers. These vectors are fed sequentially to the RNN which will obtain a
xed length vector containing all the information extracted from the tweet. Then
a multilayer perceptron will take that as input and perform the classi cation task
as stated in Section 3.3. We use 128 as the embedding size and 64 as the hidden
state of the recurrent unit. The multilayer perceptron has 64 units on its hidden
layer.</p>
        <p>In order to transform the text into a sequence of vectors of real numbers
we must project our vocabulary into an embedding layer which will hold the
continuous representation of every word (or character, depending on the
representation) on the vocabulary. This continuous representation will be learned
during the training process (no pretrained word embeddings used).</p>
        <p>
          Moreover, additional tests have been made with a bidirectional RNN [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]
(analyzes the tweet from the start and from the end) and with the use of Gated
Recurrent Units (GRU, [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]) and Long-Short Term Memory (LSTM, [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]).
4
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Results</title>
      <p>In Table 1 are compiled all the results obtained by training di erent models
with di erent representations of the data and di erent con gurations. By
looking at the table we can see that the best results are those obtained with the
multilayer perceptron with bag of words representation. We can also see that
other representations like tf-idf or other sizes of n-grams obtain similar results
although with a slightly lower score. However, with better ne-tuning we were
able to get better models that achieved several points above the ones presented
in the results with the bag of 3-grams representation. For example, the model
that generated the submission le achieved 62.4 f1-measure on the development
set.</p>
      <p>
        Ensembles are used to try to obtain better results by combining the same
model with di erent initialization. This has been proven to yield better results
[
        <xref ref-type="bibr" rid="ref10 ref5">5,10</xref>
        ]. However we nd that in our case we do not gain much. Results obtained
with ensembles are similar to the ones obtained with each model of the given
ensemble.
      </p>
      <p>Special attention has been paid to select which models were used to be part
of the ensemble because the F-measure obtained was greatly in uenced with the
performance obtained in one of the classes (usually, the one with fewer samples).
If this had not been taken into account, the results obtained would have been
much worse.</p>
      <p>In the case of RNNs they have performed very poorly compared to the MLP
probably due to the short length of the tweets, noisy behavior and low number
of samples.</p>
      <p>Finally, we only see a slight improvement with the character-wise
representation when we use tf-idf bag of n-grams. All the others con gurations performed
worse than its word-wise variants.
Various ways for classifying tweets have been tested in order to nd which model
suits the task the best. From a simple multilayer perceptron to RNN with gated
units. Models trained with the rst architecture (MLP) yielded the best results
while the ones obtained with RNN were signi cantly lower.</p>
      <p>We think that this is due to the small size of the dataset with just a few
thousands of samples. This has a major drawback: great over tting (and then, poor
generalization). The expressiveness of the MLP is enough to achieve an
acceptable performance with the data at hand while being in control of the over tting.
However, although RNNs have a greater expressiveness, they also need much
more data, especially to learn the word embedding, in order to accomplish good
generalization. This makes RNN much more suited to tasks where the number
of samples is big enough to learn its underlying characteristics.</p>
      <p>The MLP architecture with the bag of 3-grams representation used in our
experiments achieved the 3rd best result of all participants in COSET shared
task.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Batool</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Khan</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hussain</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Maqbool</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Afzal</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Towards personalized health pro ling in social network</article-title>
          .
          <source>Proceedings of the 6th International Conference on New Trends in Information Science, Service Science and Data Mining</source>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bird</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Klein</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Loper</surname>
          </string-name>
          , E.:
          <article-title>Natural language processing with Python: analyzing text with the natural language toolkit. "</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <source>Inc."</source>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Chung</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gulcehre</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cho</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bengio</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          :
          <article-title>Empirical evaluation of gated recurrent neural networks on sequence modeling</article-title>
          .
          <source>arXiv preprint arXiv:1412.3555</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Gimenez</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baviera</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Llorca</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gamir</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Calvo</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rosso</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rangel</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Overview of the 1st classi cation of spanish election tweets task at ibereval 2017</article-title>
          .
          <source>In: Proceedings of the Second Workshop on Evaluation of Human Language Technologies for Iberian Languages (IberEval</source>
          <year>2017</year>
          ), Murcia, Spain,
          <source>September 19, CEUR Workshop Proceedings. CEUR-WS.org</source>
          ,
          <year>2017</year>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Hansen</surname>
            ,
            <given-names>L.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Salamon</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Neural network ensembles</article-title>
          .
          <source>IEEE transactions on pattern analysis and machine intelligence</source>
          <volume>12</volume>
          (
          <issue>10</issue>
          ),
          <volume>993</volume>
          {
          <fpage>1001</fpage>
          (
          <year>1990</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Hochreiter</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidhuber</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>Long short-term memory</article-title>
          .
          <source>Neural computation 9(8)</source>
          ,
          <volume>1735</volume>
          {
          <fpage>1780</fpage>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Mikolov</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          , Kara at, M.,
          <string-name>
            <surname>Burget</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cernocky</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Khudanpur</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Recurrent neural network based language model</article-title>
          .
          <source>In: Interspeech</source>
          . vol.
          <volume>2</volume>
          , p.
          <volume>3</volume>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Schuster</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paliwal</surname>
            ,
            <given-names>K.K.:</given-names>
          </string-name>
          <article-title>Bidirectional recurrent neural networks</article-title>
          .
          <source>IEEE Transactions on Signal Processing</source>
          <volume>45</volume>
          (
          <issue>11</issue>
          ),
          <volume>2673</volume>
          {
          <fpage>2681</fpage>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Sutskever</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vinyals</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Le</surname>
            ,
            <given-names>Q.V.</given-names>
          </string-name>
          :
          <article-title>Sequence to sequence learning with neural networks</article-title>
          .
          <source>In: Advances in neural information processing systems</source>
          . pp.
          <volume>3104</volume>
          {
          <issue>3112</issue>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>West</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dellana</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Qian</surname>
          </string-name>
          , J.:
          <article-title>Neural network ensemble strategies for nancial decision applications</article-title>
          .
          <source>Computers &amp; operations research 32(10)</source>
          ,
          <volume>2543</volume>
          {
          <fpage>2559</fpage>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>