Using Noisy Self-Reports to Predict T witter User Demographics (2021)

Abstract: Computational social science studies often contextualize content analysis within standard demographics. Since demographics are unavailable on many social media platforms (e.g. Twitter), numerous studies have inferred demographics automatically. Despite many studies presenting proof-of-concept inference of race and ethnicity, training of practical systems remains elusive since there are few annotated datasets. Existing datasets are small, inaccurate, or fail to cover the four most common racial and ethnic groups in the United States. We present a method to identify self-reports of race and ethnicity from Twitter profile descriptions. Despite the noise of automated supervision, our self-report datasets enable improvements in classification performance on gold standard self-report survey data. The result is a reproducible method for creating large-scale training resources for race and ethnicity.

## introduction contextualization of population studies with demographics forms a central analysis method within the social sciences. in domains such as political science or public health, standard demographic panels in telephone surveys enable better analyses of opinions and trends. demographics such as age, gender, race, and location are often proxies for important socio-cultural groups. as the social sciences increasingly rely on computational analyses of online text data, the unavailability of demographic attributes hinders comparison of these studies to traditional methods @xcite @xcite . ## ethical considerations complexities of racial identity raise ethical considerations, requiring discussion of the benefits and harms of this work @xcite . the benefits are clear in settings such as public health; many studies use social media data to research health behaviors or support health-based interventions @xcite . these methods have transformed areas of public health which otherwise lack accessible data @xcite . aligning social media analyses with traditional data sources requires demographic information. the concerns and potential harms of this work are more complex. ongoing discussions in the literature concern the need for informed consent from social media users @xcite @xcite . twitter's privacy policy states that the company "make[s] public data on twitter available to the world," but many users may not be aware of the scope or nature of research conducted using their data @xcite . participant consent must be informed, and we should study users' comprehension of terms of service when conducting sensitive research. irbs have applied established human subjects research regulations in ruling that passive monitoring of social media data falls under public data exemptions. while our data usage agreement prohibits such behavior, a malicious actor could attempt to use predicted user demographics to track or harass minority groups. despite the severity of such a worst-case scenario, there are two arguments why the benefits may outweigh the harms. first, if open-source methods and models were used for such malicious behavior, platform moderators could simply incorporate those tools into combatting any automated harassment. second, harassment against historically disenfranchised groups is already extremely widespread. open-source tools would provide more good than harm in the hands of researchers or platform moderators @xcite . recent work has show that women on twitter, especially journalists and politicians, receive disproportionate amounts of abuse @xcite . on facebook, advertisers have used the platform's knowledge of users' racial identities to illegally discriminate when posting job or housing ads @xcite . to protect against misuse of our work, we follow twitter's developer terms which prohibit efforts to "target, segment, or profile individuals" based on several sensitive categories, including racial or ethnic origin, detailed in our data use agreement. predictions should not be analyzed to profile individual users but rather must only be used for aggregated analyses. another concern of any predictive model for sensitive traits is that a descriptive model could be interpreted as a prescriptive assessment @xcite . individual language usage may also differ from population-level demographics patterns @xcite . additionally, our datasets and models do not cover smaller racial minorities (e.g. pacific islander) or the fine-grained complexities of mixed-race identities. more fine-grained methods are needed for many analyses, but current methods cannot support them. finally, we distinguish between biased models and biased applications. our models are imperfect; if we only analyze a small sample of users and our models have high error rates, a difference that appears significant may be an artifact of misclassifications. any downstream application must account for this uncertainty. on the whole, we believe demographic tools provide significant benefits that justify the potential risks in their development. we make our data available to other researchers, but with limitations. we require that researchers comply with a data use agreement and obtain approval by an irb or similar ethics committee. our agreement restricts these tools to population-level analyses 3 and not the analysis of individual users. we exclude certain applications, such as targeting of individuals based on race or ethnicity. any future research that makes demographically-contextualized conclusions from classifier predictions must explicitly consider ethical trade-offs specific to its application. finally, our analysis of social media for public health research has been irb reviewed and deemed exempt (45 cfr 46.101(b)(4)). ## datasets for race and ethnicity our tools and analysis focus on the united states, where recognized racial categories have varied over time @xcite . current us census -and many surveys -record self-reported racial categories as white, black, american indian, asian, and pacific islander. surveys often frame ethnicity as hispanic/latinx origin or not; however, there is not necessarily a clear distinction between race and ethnicity @xcite @xcite . individuals may identify as both a race and an ethnicity, and 2% of americans identify as multi-racial @xcite . because of the limited data availability, we only consider the four largest race/ethnicity groups, which we model as mutually exclusive: white, black, asian, and hispanic/latinx. our methodology could be extended to be more comprehensive, but we do not yet have the means to validate more fine-grained or intersectional approaches. gold-standard labels for sensitive traits requires individual survey responses, but this yields small or skewed datasets due to the expense (preot ¸iuc-pietro and ungar, 2018). our approach instead relies on automated supervision from racial self-identification and minimal manual annotation to refine our dataset labels. we are not the first to use users' self-identification to label twitter users' demographics, but past work has relied heavily either on restrictive regular expressions or manual annotation @xcite . such work has also been limited to datasets of under 10,000 users. we expand on previous work to construct a much larger dataset and evaluate it via trained model performance on ground-truth survey data. ## data collection of self-reports we construct a regular expression for terms associated with racial identity. we select tweets from twitter's 1% sample from july 2011 to july 2019 in which the user's profile description contains one of the following racial keywords in english: black, african-american, white, caucasian, asian, hispanic, latin, latina, latino, latinx. while there are other terms that signify racial identity, these match common survey panels @xcite and our empirical evaluation is limited because our survey dataset only covers four classes. we omit self-reports that indicate a country of origin (e.g. "colombian" or "chinese-american"), smaller racial minorities (e.g. "native american" or "two or more races"), or more ambiguous terms, leaving such groups for future work. if a user appears multiple times, we use their latest description. we select users whose profile descriptions contain a query keyword, which heavily skews towards color terms ("white", "black"). this produces 2.67m users, 2.50m of which match exactly one racial/ethnic class ( we next consider approaches to filter these users' profile descriptions to obtain three self-report datasets of different sizes and precisions. for all three datasets, we use a model that assigns a "self-report" score based on the likelihood that a profile contains a self-report. we then use a binary cutoff to only include users with a high enough self-report score. we obtain this score by leveraging lexical co-occurrence, an important cue for word associations @xcite . we combine relative frequencies of co-occurring words within a fixed window, weighed by distance between query and co-occurring self-report words. for example, if "farmer" is a self-report word, then "black farmer" should score higher than "black beans farmer" since the query and self-report word are closer. we choose the window size and threshold for this score function on a manually-labeled tuning set, after which our scoring function achieves 72.4% accuracy on a manually-labeled test set. details on preprocessing and our self-report score are in appendices a and b. our first dataset selects users with a bigram containing a racial keyword followed by a "person keyword." our person keywords are: man, woman, person, individual, guy, gal, boy, and girl so this method matches users with descriptions containing bigrams such as "black woman" or "asian guy." we expect this method to have high precision, but it has extreme label imbalance; 91% of the users are labeled as either white or black. from the twitter 1% sample, this dataset contains 122k users, but only 112k users could be re-scraped in 2019. we refer to this dataset as query-bigram (qb). as qb contains only 112k users, we consider a less restrictive approach. our second dataset uses four heuristic filters to remove false positives from the original 2.67m users. many descriptions spuriously match "black" and "white" in addition to other colors, so we filtered out all words from a color-list @xcite . second, we filter out racial keywords followed by plural nouns (e.g. "white people"), using nltk tweettokenizer @xcite to obtain part-of-speech tags. we curate a list of 286 google bigrams that frequently contain a query but are unlikely to be self-reports (e.g. "black sheep,") @xcite . finally, we ignore query words that appear inside quotation marks. as qb and hf are quite imbalanced, we design a third dataset to equally represent all four classes. across both our qb and hf datasets we have only 7,756 hispanic/latinx users that we could scrape in 2019, making it our smallest demographic class. we thus use our self-report scores to select the highest-scoring 7,756 users from each of other classes, producing our class-balanced (cb) dataset of 31k users. ## experimental evaluation we now conduct an empirical evaluation of our noisy self-report datasets. showing that our datasets produce accurate classifiers demonstrates the value of our noisy self-report method for dataset construction. we train supervised classifiers on both our and existing datasets, comparing classifier performance in two evaluation settings. we divide the six datasets described in the balanced and imbalanced dev sets are used for all model and training set combinations in ## experimental results and discussion across all balanced evaluations, all but one of the models trained with our collected datasets outperform models trained only on crowd in both accuracy and f1. several models improve by more than .10 f1 over models trained only on crowd. the bert models achieve the best performance in the balanced evaluation, while performing relatively poorly on imbalanced data. this occurs because the bert models achieve high accuracy on the black and asian classes, which are underrepresented in our imbalanced test set. we show a confusion matrix for our best balanced model in these models are quite simple, and more complex models could improve performance independent of the dataset. however, by limiting ourselves to simpler models, we can demonstrate that for learning a classifier that performs well on four-class classification of race and ethnicity, our noisy datasets are clearly beneficial. while the self-reports are noisy, we collect enough data to support better classifiers on held-out, gold-standard labels. despite this experimental improvement, real-world applications may require more accurate classifiers or may need to prioritize classifiers with high precision or recall for a particular group. ## twitter behaviors across groups our experiments show that our datasets enable better predictive models, but say nothing about how self-reporting users use twitter. do different groups in our dataset differ in other behaviors? we explore this using a variety of quantitative analyses of twitter user behavior, following similarly-motivated public health research @xcite @xcite . two interpretations are possible for these group-level differences: either user behavior correlates with demographic categories @xcite , or the choice to self-report correlates with these behaviors. these can both be true, and our current methods cannot distinguish between them. while our empirical evaluation shows that our data is still useful for training classifiers to predict gold-standard labels, possible selection bias may influence real-world applications. lexical features are widely used to study twitter @xcite . for each user in our dataset, we follow §3.1 of @xcite and calculate type-token ratio foot_1 , lexical diversity foot_2 @xcite , and the number of hashtags and english contractions they use per tweet. we then use existing trained models for analyzing formality and politeness @xcite of online text. the formality score is estimated with a regression model over lexical and syntactic features including n-grams, dependency parse, and word embeddings. the politeness classifier uses unigram features and lexicons for gratitude and sentiment. we use the published implementations. 6,7 for both trained models, we macro-average over users' scores to obtain a value for each demographic group. we also use a sage @xcite lexical variation implementation to find the words that most distinguish each group. the means of the six quantitative features and the top five sage keywords for each group is shown in we then consider a few basic measures of twitter usage, computed from the profile information of each user. these analyses show substantial differences between the groups labeled by our self-report methods, suggesting our noisy self-reports correlate with actual twitter usage behavior. however, it cannot reveal whether these differences primarily correlate with racial/ethnic groups or whether these differences appear from how users decide whether to self-report a race/ethnicity keyword. researchers working on downstream public health applications (e.g. @xcite ) may want to account for these empirical differences between groups in our training datasets when drawing conclusions about users in other datasets. ## limitations and future work we have presented a reproducible method for automatically identifying self-reports of race and ethnicity to construct an annotated dataset for training demographic inference models. while our automated annotations are imperfect, we show that our data can replace or supplement manually-annotated data. our data collection methodology does not rely on large-scale crowd-sourcing, making it more reproducible and easier to keep datasets up-to-date. these contributions enable the development and distribution of tools to facilitate demographic contextualization in computational social science research. there are several important extensions to consider. first, our analysis focuses on the united states and english-language racial keywords; most countries have a unique cultural conceptualizations of race/ethnicity and unique demographic composition, and may require a country-specific focus. we only cover four categories of race/ethnicity, ignoring smaller populations and multi-racial categories @xcite . we use a limited set of query terms, which ignores the diversity of how people may choose to self-report their identities. while our methods scale easily to additional categories and/or racial keywords, our evaluation method requires a gold-standard test set that covers those groups. for specific applications, a domain expert might prioritize precision or recall for a specific demographic class. this may involve fine-tuning a classifier on a dataset constructed with a particular class-imbalance; the details of that imbalance should be contextualized with the general class distribution of the population on twitter. our analyses could be compared against human perceptions of users' racial identity, though past work has suggested such perceptions have underlying biases @xcite . finally, past work has highlighted various biases in demographic inference @xcite , and our analyses cannot fully rule out the presence of such biases in our data or models. in future work, we strongly encourage the study of racial self-identities and social cultural issues as supported by computational analyses. these issues should be viewed from a global perspective, especially with regards to biases in our collection methods @xcite . we release our code in the demographer package to enable training new models and constructing future updated datasets. we also release our trained models and annotated twitter user ids for academic researchers that agree to the data use agreement and obtain approval from an ethics board.