• No se han encontrado resultados

1. FUNDAMENTOS TEÓRICOS Y COORDENADAS ANALÍTICAS

1.2. LOS VALORES DE LA CIUDAD

1.2.4. La mal llamada Ciudad Difusa

The prediction model to be proposed tries to make a prediction of the social event outcome according to social network data analysis. Plenty of data is generated by social networks, but fake information and useless data also come into the dataset, which strongly affects the model accuracy. Therefore, Twitter data collection and processing is important in my research.

3.1 Social Media Data Collection

First, I need to verify the data in social network distribution and get the data by using the API of a social network. Then I need to consider which features of data to define the problem and figure out which components to represent the social network data best. Then I need to analyse the data to get the behaviour of users. According to the behaviour of users, I can judge the general opinion of the social network. To collect data for this research, I choosed Twitter. This big social network company provides APIs to access their social networks for getting data, which is easier compared with scanning the webpages. I also learn how to use these APIs to get target data. Their APIs provide many data, with tags included in the context.

The Twitter APIs offer a number of options for public members to gather data from the platform. Researchers can purchase access to the Firehose, Twitter’s real-time flow of all new tweets and their related metadata, and those seeking historical data can purchase all relevant public, undeleted tweets from Twitter’s archive. However, both of these options can be extremely cost prohibitive. Thus, academic researchers have

largely turned to Twitter’s free services, a set of public APIs. The first of these, Twitter’s Streaming API, provides tweets in real-time and can be queried using keyword, user ID, and geolocation parameters. When undertaking keyword queries of tweet content, the Streaming API matches keywords in the body of a tweet, the body of quoted tweets, URLs, hashtags, and @mentions. In my case, I collected tweets with “French election” tweets and hashtags. Twitter’s documentation suggests that the Stream can return “up to” 100% of all tweets meeting one’s query criteria, as long as the relevant tweets constitute less than 1% of the global volume of tweets at any given moment. When that 1% threshold is reached, the API begins to impose rate limits. Twitter’s current global volume averages 6,000 tweets per second. However, this figure fluctuates significantly from day to day, hour to hour, and even minute to minute, driven in large part by unpredictable external events such as natural disasters, terrorist attacks, and other shocking or controversial news items. The API does provide rate limit messages, allowing a user to know when rate limits have been imposed, but these do not indicate what types of messages are missing, that is, if there is a systematic character to the tweets that are not captured. Moreover, Twitter’s documentation does not suggest that 100% of tweets necessarily to be provided, even when no rate limits are imposed. The second common source of Twitter data, the Search API, is a component of the larger REST API and may be used to query historical data. This option is clearly advantageous for collecting data on issues or events that cannot be easily predicted in advance. However, Search API queries carry significant limitations. First, the Search API only reaches back 6~7 days. Second, each call to the API can return a maximum of just 18,000 tweets, and Twitter limits users to 180 calls every 15 minutes. In addition, queries to the Search API provide matches only to the main text of a tweet. Finally, and perhaps most importantly, Twitter makes it clear that Search

results are non-random. The company states that queries return “top” content, not all relevant tweets, but Twitter does not clarify what constitutes “top” content. All data are in English language because the language barrier between French and me.

3.2 Data Processing and Modelling

Another problem in Twitter data collection is how to measure a single user and classify the relationship. I analysed the online data which creates an online context and comments on it. The context of Twitter can provide the behaviour of users to predict the result. Twitter data can reflect the relationship between different users and tweets. Based on retweets tag and user id, I can convert tweets as a social network and classify their topics to predict the outcome of the event. Firstly, I labelled all tweets with different candidates or parties. Based on different candidates, the whole twitter information are classified in different groups. Then I sort and summary the ID of the user based on groups. I summarized the edge of the user and labelled tweets for different candidates inner their group of data. Excel and Python could summarized all user ID and tweets. Based on hashtag of retweet, the retweet ID are summarized. Most of tweets are in the same context which is easy to label. To construct the social network, I count the times of retweets as strengths of edge, which provides more information of the community. In word count, I selected words with high frequency in each candidate and classified them as negative or positive by knowledge.

In whole collection period, more than 40000 tweets collected by twitter API. However, the weekend usually get less tweets than week day. Thus the weekend data are wiped out. After wiped out, there are 38000 tweets in total analysis.

Chapter 4: Prediction of the 2017 French Election Based on