Skip to main content
Log in

Predicting the ideological orientation during the Spanish 24M elections in Twitter using machine learning

  • Open Forum
  • Published:
AI & SOCIETY Aims and scope Submit manuscript

Abstract

Through the application of machine learning techniques, this paper aims to estimate the importance of messages with ideological load during the elections held in Spain on May 24th, 2015 posted by Twitter’s users, as well as other variables associated with the publication of these types of messages. Our study collected and analysed 24,900 tweets associated to two of the main trending topics’ hashtags (#24M and #Elections2015) used in the election day and build a predictive model to infer the ideological orientation for the messages which made use of these hashtags during Election Day. This approach allows us to classify the ideological orientation of all collected tweets, instead of only tweets that explicitly express their ideological or partisan preferences in the messages. Using the ideological orientation for all tweets predicted by our model, it was possible to identify how messages with a defined ideological load were pushed forward by users with leftist tendencies. We also observed a relationship between these messages and the partisan orientation of those who published them.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3

Similar content being viewed by others

Notes

  1. https://www.twitonomy.com.

  2. http://www.trendinalia.com.

  3. http://nltk.org.

  4. In fivefold cross validation, the training set is split in five folds of similar length. Four folds are used for training the model, and the remaining fold for testing. The process is repeated five times, and a different fold is used for testing in each repetition.

References

  • Anduiza E et al (2013) Mobilization through online social networks: the political protest of the indignados in Spain. Inf Commun Soc. doi:10.1080/1369118X.2013.808360

    Google Scholar 

  • Aragón P et al (2013) Communication dynamics in Twitter during political campaigns: the case of the 2011 Spanish national election. Policy Internet. doi:10.1002/1944-2866

    Google Scholar 

  • Barberá P, Rivero G (2014) Understanding the political representativeness of Twitter Users. Soc Sci Comput Rev. doi:10.1177/0894439314558836

    Google Scholar 

  • Batrinka B, Treleaven PC (2015) Social media analytics: a survey of techniques, tools and platforms. AI Soc. doi:10.1007/s00146-014-0549-4

    Google Scholar 

  • Bird S et al (2009) Natural language processing with Python. O′Reilly Media, Boston

    MATH  Google Scholar 

  • Breiman L (2001) Random forests. Mach Learn. doi:10.1023/A:1010933404324

    MATH  Google Scholar 

  • Calderón A, Espinosa A (2006) Ideología política, valores culturales y miedo a la muerte: su impacto después de los atentados del 11 de Marzo. Psicología Política 32:33–38

    Google Scholar 

  • Canel MJ (1999) Comunicación política: técnicas y estrategias para la sociedad de la información. Tecnos, Madrid

    Google Scholar 

  • Casero-Ripollés A, Feenstra R (2012) The 15-M movement and the new media: a case study of how new themes were introduced into spanish political discourse. Media Int Aust. doi:10.1177/1329878X1214400111

    Google Scholar 

  • CIS (2014) Barómetro de Octubre 2014, http://www.cis.es/cis/export/sites/default/-Archivos/Marginales/3040_3059/3041/es3041mar.pdf. Accessed 15 dec 2016

  • CIS (2015) Barómetro de Enero 2015. http://www.cis.es/cis/export/sites/default/-Archivos/Marginales/3040_3059/3050/es3050mar.pdf. Accessed 15 dec 2016

  • Colleoni E et al (2014) Echo chamber or public sphere? predicting policital orientation and measuring political hemophily in Twitter using big data. J Commun. doi:10.1111/jcom.12084

    Google Scholar 

  • Congosto M et al (2011) Twitter y política: información, opinión y ¿predicción? Cuadernos de comunicación Evoca 4:11–16

    Google Scholar 

  • Cordero G (2008) ¿ Qué es ideología? El caso español. Universidad Autónoma de Madrid, Madrid

    Google Scholar 

  • Del Fresno M et al (2015) Unveiling climates of opinion through social media mining and social network analysis in Twitter. The case of common core state standards. Redes. Revista hispana para el análisis de redes sociales. doi:10.5565/rev/redes.531

    Google Scholar 

  • Deltell L (2012) Estrategias de comunicación política en las redes sociales durante la campaña electoral del 2011 en España: el caso de eQuo. Asociación de Sociología Madrileña, Madrid

    Google Scholar 

  • Deltell L et al (2013) Predicción de tendencia política por Twitter: Elecciones Andaluzas 2012. Ambitos Revista internacional de comunicación 22:91–100

    Google Scholar 

  • Denzau A, North D (1994) Shared mental models: ideologies and institutions. Kyklos. doi:10.1111/j.1467-6435.1994.tb02246.x

    Google Scholar 

  • Elmer G (2012) Live research: Twittering an election debate. New Media Soc. doi:10.1177/1461444812457328

    Google Scholar 

  • Flach P (2012) Machine learning: the art and science of algorithms that make sense of data. Cambrige Press University, Cambrige

    Book  MATH  Google Scholar 

  • Fominaya CF (2014) Social movements and globalization: how protests, occupations and uprisings are changing the world. Palgrave Macmillan, New York

    Book  Google Scholar 

  • Gimpel K et al (2011) Part-of-speech tagging for Twitter: annotation, features, and experiments’, in Association for Computational Linguistics. Association for Computational Linguistics, Baltimore

    Google Scholar 

  • Gruzd A, Roy J (2014) Investigating political polarization on Twitter: a Canadian perspective. Policy Internet. doi:10.1002/1944-2866

    Google Scholar 

  • Iyyer M et al (2014) Political ideology detection using recursive neural networks. Association for Computational Linguistics, Baltimore

    Book  Google Scholar 

  • Jost JT (2006) The end of the end of ideology. Am Psychol. doi:10.1037/0003-066X.61.7.651

    Google Scholar 

  • Koc-Michalska K et al (2014) Poland’s 2011 online election campaign: new tools, new professionalism, new ways to win votes. J Inf Technol Politics. doi:10.1080/19331681.2014.899176

    Google Scholar 

  • Levy Paul S, Lemeshow S (2013) Sampling of populations: methods and applications. John Wiley & Sons, New Jersey

    MATH  Google Scholar 

  • López TR et al (2013) The political communication in the “Social media”: comparative analysis of the campaign of Barack Obama and Hillary Clinton in 2008. Historia y Comun Soc. doi:10.5209/rev_HICS.2013.v18.44367

    Google Scholar 

  • Margolis M, Resnick D (2000) Politics as usual: the cyberspace “Revolution”. SAGE Publications, Thousand Oaks

    Google Scholar 

  • Marlin-Bennett R (2011) I hear America tweeting and other themes for a virtual polis: rethinking democracy in the global infotech age. J Inf Technol Politics. doi:10.1080/19331681.2011.532675

    Google Scholar 

  • Mayer-Schönberger V, Cukier K (2013) Big data: a revolution that will transform how we live, work, and think. Mariner Books, Boston

    Google Scholar 

  • Oshiro TM, Perez PS, Baranauskas JA (2012) How many trees in a random forest? In: 8th International Conference on Machine Learning and Data Mining (MLDM’2012). Volume 7376 of Lecture Notes in Computer Science pp 154–168

  • Pedregosa F et al (2011) Scikit-learn: machine learning in Python. J Mach Learn Res. doi:10.1016/j.patcog.2011.04.006

    MathSciNet  MATH  Google Scholar 

  • Puddington A (2013) Freedom in the World 2013: Democratic Breakthroughs in the Balance. Freedom House, Washington. http://www.refworld.org/docid/5194c7de4.html. Accessed 21 Jun 2016

  • Quinlan JR (1986) Induction of decision trees. Mach Learn. doi:10.1023/A:1022643204877

    Google Scholar 

  • Robins D, Frati FE, Alvarez J, Texier J (2016) Balotage in Argentina 2015, a sentiment analysis of tweets. http://arxiv.org/abs/1611.02337. Accessed 21 Jun 2016

  • Rodríguez R, Ureña D (2011) Diez razones para el uso de Twitter como herramienta en la comunicación política y electoral. Comunicación y pluralismo 10:89–107

    Google Scholar 

  • Salton G et al (1975) A vector space model for automatic indexing. Commun ACM. doi:10.1145/361219.361220

    MATH  Google Scholar 

  • Sánchez G, Sánchez R (2009) Ideological orientations of citizens in Europe. Papel Politico 14:645–667

    Google Scholar 

  • Segerberg A, Bennett WL (2011) Social media and the organization of collective action: using Twitter to explore the ecologies of two climate change protests. Commun Rev. doi:10.1080/10714421.2011

    Google Scholar 

  • Tayal DK, Yadav SK (2016) Sentiment analysis on social campaign “Swachh Bharat Abhiyan” using unigram method. AI & Soc. doi:10.1007/s00146-016-0672-5

    Google Scholar 

  • Wagner KM, Gainous J (2013) Digital uprising: the internet revolution in the Middle East. J Inf Technol Politics. doi:10.1080/19331681.2013.778802

    Google Scholar 

  • Wu HC et al (2008) Interpreting TF-IDF term weights as making relevance decisions. ACM Trans Inf Syst. doi:10.1145/1361684.1361686

    Google Scholar 

  • Xu G, Li L (2013) Social media mining and social network analysis: emerging research, information. Science reference. IGI Global, Hershey

    Book  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Elias Said-Hung.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Prati, R.C., Said-Hung, E. Predicting the ideological orientation during the Spanish 24M elections in Twitter using machine learning. AI & Soc 34, 589–598 (2019). https://doi.org/10.1007/s00146-017-0761-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00146-017-0761-0

Keywords

Navigation