{'fraction_non_alphanumeric': 0.025658274072650394, 'fraction_numerical': 0.005573707476455891, 'mean_word_length': 4.434464751958225, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Comparison of Feature Extraction Methods and Predictors for Income Inference

Patterns of mobile phone communications, coupled with the information of the social network graph and financial behavior, allow us to make inferences of users' socio-economic attributes such as their income level. We present here several methods to extract features from mobile phone usage (calls and messages), and compare different combinations of supervised machine learning techniques and sets of features used as input for the inference of users' income. Our experimental results show that the Bayesian method based on the communication graph outperforms standard machine learning algorithms using node-based features.


I. INTRODUCTION
Mobile phone datasets present a rich view into social interactions and physical movements of large segments of the population. The voice calls and text messages exchanged between people, together with the locations of these communications, allow us to construct a rich social graph which provides insights on the users social fabric.
There is a strong homophily in the population's communications graph respect to economic variables such as the user's income [1], which results largely from social stratification between populations of different purchasing power [2] or purchasing patterns [3]. Additionally, and in part resulting from this stratification, there are different patterns of communication between users of distinct socioeconomic level [4].
Finding the best way to parse Call Detail Records (CDRs) to generate user features and construct their communications graph is still a subject of research. After describing our data sources, we present several methods of feature extraction from the raw CDR data, and describe the supervised machine learning algorithms used to predict the socioeconomic level of users, given a ground truth for a relatively small subset of the population. In particular we tested the Bayesian approach for income inference presented in [1]. Finally, we present our experimental results, comparing the performance obtained according to the feature set and the algorithms used.

II. DATA SOURCES
The data used in this study contains a set P of Call Detail Records (CDRs), composed of voice calls, and another set S containing text messages, from a telecommunication company (telco) for a period of 3 consecutive months. Using this data we create the social graph G = V, E where each v ∈ V is a user of the telco, and E contains calls between those users. Each element e ∈ E contains information about the Origin and Destination users, in addition to the amount of Calls, the total call Time, and the amount of SMS exchanged.
Additionally, we have access to information about a set B of bank accounts, for which we calculate the monthly income for each user p s . In this paper we separate the users into two groups of equal size: Low Income and High Income.
B contains information about the users' telephone number, which is anonymized in the same way as the telco data. Therefore, we can match the data in these two datasets in order to construct the Ground Truth T ⊆ V , where each element of T contains its income category, along with the Inner Graph G ′ = V ′ , E ′ where E' contains edges where at least one endpoint is in T , and V ′ is the set of endpoints of all elements in E ′ .

III. ACCUMULATED GRAPH FEATURES
This section presents several ways of transforming data from the graph G = V, E into individual features for each user v ∈ V . The aggregations are classified into levels named according to the transformation done to G, and they are merged with levels containing less information. The total amount of columns in each featureset is presented in Table II. A. User Data -Level Ring 1 The first accumulated features consist of accumulating the three quantifiable features, Calls, Time and SMS, for every node, separated on whether those features are incoming or outgoing.

B. Higher Order User Data -Level Ring n>1
The ego network of the node v is defined as the graph consisting of v and its neighbors. A simple way to get more features about that node is to accumulate the calls and SMS information about the edges which are not part of the ego network, but contain one endpoint on the border of the ego network.
Similarly, we define the user data of order n, for any natural number n, as the accumulation of calls and SMS information for the nodes which are part of the ego network of order n, which is the set of nodes which are at distance at most n of v, and are not part of the ego network of order n − 1, which we denote as Ring n . The level Ring 1 contains the information of the regular user data, while the user data from the ego network of order n is assigned to Ring n for n > 1.   C. Categorical User Data -Level Cat n Another approach to building features is to do an approach similar to the user data presented in Section III-A, but further discriminating each feature which corresponds to each node v ∈ V and each edge e ∈ E: when t ∈ T is the other endpoint of the link e, we discriminate whether t corresponds to a user with high or low income. The resulting new features are of the form represented by the set in Equation (1). This way we create the datasets Cat 1 . . . Cat 3 by using the growing ego networks Ring 1 . . . Ring 3 .
To prevent overfitting, the set T is partitioned into two disjoint sets, G and H, where G contains roughly 75% of the nodes in T is used to calculate the features, while H contains the other 25% and is used to train the models.

IV. INFERENCE METHODOLOGY
The Inner Graph is defined so that a node h ∈ H is part of it if and only if there is an edge h, x ∈ E or x, h ∈ E such that x ∈ H. This later definition becomes important when doing inferences on features using the Categorical User Data dataset.
The inferences were performed using Logistic Regression and Random Forest classifiers, both of which are solid classifiers commonly used for cases like this [6], and since they tend to have different variance in their results [8], noise from different sources should affect differently each predictor.
The features used were the ones presented in Section III, where each level is merged with all the previous levels with the data on G. Table II shows the amount of features in each level after merging the data. The feature sets Ring 1 . . . Ring 3 and Cat 1 . . . Cat 3 are strictly increasing.
The classifiers are trained using those features and the labels in H doing a Grid Search on different hyperparameters of the predictors with 5-fold cross-validation to prevent overfitting. In addition to the accuracy, we computed several metrics for the comparison. In our real-life use cases, we are more interested in having high recall than high precision (that is, finding more high income users than being accurate), therefore we also measured the F 4 -score of each prediction.
In addition, these methods based on features aggregated by node are compared against three other methods based solely on the communication graph structure: • Random Selection which chooses a random category. • Majority Voting which chooses the most populated category in a user's ego network (or randomly in case of a tie). • Bayesian Method which uses the method presented in [1] to infer the category of each user, taking into account the uncertainty on the available information.

V. RESULTS AND CONCLUSION
The predictors were run in a computer with a single core of 2.00 GHz Intel Xeon CPU using sklearn 0.18 under Python 2.7, and 64 GB of RAM (enough to avoid caching calculations). The results of the inference can be found in Table I for the Inner Graph and in Table III for the Full Graph.  Both tables show various metrics which result from applying the methods described in Section IV with the hyperparameters that result in the highest accuracy according to the Grid Search. We use the AUC (Area under the ROC curve) to compare the different approaches.
We observe that methods based on Random Forests tend to perform better in this real-world scenario than the ones based on Logistic Regression. This may be due to the fact that Random Forests are more versatile with non-linear data [7], and is consistent with similar findings in [5].
Interestingly, increasing the breadth of the Ego Network by one level, from Ring 1 to Ring 2 improves the performance when using Random Forest learning, however it does not improve by going one level further to Ring 3 in the case of the Inner Graph, despite the fact that this dataset is a strict superset of the previous Ring 2 . This is due to the fallibility of common bagging methods like Random Forest, where having some noisy or non-informative data to choose from makes it less probable that informative features will be chosen.
Adding categorical information greatly improves the prediction when using either method, particularly on Random Forest, and, like it was noted before, adding neighbouring data of the ego network of distance 2 (Cat 2 ) also results in a better predictor. However, raising further the maximum distance to Cat 3 within the ego network in the case of the Inner Graph does not result in further improvements.
We can conclude that, within the machine learning methods presented, the best in terms of AUC is predicting the category using a Random Forest with the ego network of distance 2 data (Cat 2 ) in the case of the Inner Graph. In the Full Graph, using Cat 3 data results in slightly better results, however the difference with Cat 2 is very small.
Finally, in the Inner Graph the best method is the Bayesian Method presented in [1], which only uses the number of High Income and Low Income users in the egonetwork, but makes a "smarter" prediction than the machine learning methods LR and RF using the models Cat 1 , Cat 2 , and Cat 3 , which also contain this data.
Additionally, while its AUC is not higher than the best machine learning methods, the F 1 -score of the Majority Voting predictor is higher than all the machine learning methods.
We can reach the conclusion that, in this particular case, smaller is better. The machine learning methods which use many features (despite these features being informative) are not better at predicting the socioeconomic level of a user than the simple Majority Voting or the more complex Bayesian Method which use only 2 simple features of the communication graph.